MySQL 无法创建测试文件下层测试启动服务器mysql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41504580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't create test file lower test start server mysql
提问by Fane Fonseka
I'm following this tutorial hereon creating a JDBC programming. I've followed the steps up to the console command to start the server:
我下面这个教程在这里创建一个JDBC编程。我已经按照控制台命令的步骤启动服务器:
// For Windows
cd {path-to-mysql-bin} // Check your MySQL installed directory
mysqld --console
I get the following error message:
我收到以下错误消息:
mysqld: Can't change dir to 'C:\Program Files\MySQL\MySQL Server 5.7\data\' (Errcode: 2 - No such file or directory)
2017-01-06T10:54:36.968210Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-06T10:54:36.968210Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-01-06T10:54:36.968210Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 11248 ...
2017-01-06T10:54:36.974226Z 0 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.7\data\DESKTOP-DEQ2IC2.lower-test
2017-01-06T10:54:36.975229Z 0 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.7\data\DESKTOP-DEQ2IC2.lower-test
2017-01-06T10:54:36.975229Z 0 [ERROR] failed to set datadir to C:\Program Files\MySQL\MySQL Server 5.7\data\
2017-01-06T10:54:36.976231Z 0 [ERROR] Aborting
2017-01-06T10:54:36.977234Z 0 [Note] Binlog end
2017-01-06T10:54:36.978237Z 0 [Note] mysqld: Shutdown complete
I'm quite new to using MySql in this way but I can see that there is no data folder in the server directory and no my.ini file which I assumes holds the config information on where the data directory is. I've also insntalled MySql using the windows installer which I've readcould be why there is no my.ini file and just a template my-default.ini file.
我对以这种方式使用 MySql 很陌生,但我可以看到服务器目录中没有数据文件夹,也没有 my.ini 文件,我认为该文件包含有关数据目录位置的配置信息。我还使用我读过的 Windows 安装程序安装了 MySql,这可能是为什么没有 my.ini 文件而只有模板 my-default.ini 文件的原因。
Does anyone know why this is happening?
有谁知道为什么会这样?
回答by Senthil Nathan
Create a data folder in C:\Program Files\MySQL\MySQL Server 8.0.
在其中创建数据文件夹 C:\Program Files\MySQL\MySQL Server 8.0.
Create a new file with
创建一个新文件
(ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';)
command for password reset (if required)
密码重置命令(如果需要)
Make sure that your file is in C:
drive. root folder.
确保您的文件在C:
驱动器中。根文件夹。
Then execute the below command:
然后执行以下命令:
C:\> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
C:\> mysqld --init-file=C:\mysql-init.txt
回答by Konstantin
In my case, I installed MySQL with Windows installer on the D:/
drive and was set NOTto run as Windows service.
I managed to resolve the issue by moving my.ini
from C:\ProgramData\MySQL\MySQL Server 8.0to MySQL installation folder.
就我而言,我在D:/
驱动器上安装了带有 Windows 安装程序的 MySQL,并设置为不作为 Windows 服务运行。我设法通过my.ini
从C:\ProgramData\MySQL\MySQL Server 8.0 移动到 MySQL 安装文件夹来解决这个问题。
回答by Ali
As mentioned above, create a "data" folder, (for me after that it didn't show errors, but it wasn't stills starting).
After that, go to services.msc in windows and start it from there. Also set it to Automatic so it starts automatically whenever you start the windows.
It worked for me.
如上所述,创建一个“数据”文件夹(对我来说之后它没有显示错误,但它并没有开始)。
之后,转到 windows 中的 services.msc 并从那里启动它。还将其设置为“自动”,以便在您启动 Windows 时自动启动。它对我有用。