【发布时间】:2017-05-21 03:36:06
【问题描述】:
我正在关注本教程 here 创建 JDBC 编程。我已经按照控制台命令的步骤来启动服务器:
// For Windows
cd {path-to-mysql-bin} // Check your MySQL installed directory
mysqld --console
我收到以下错误消息:
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
我对以这种方式使用 MySql 很陌生,但我可以看到服务器目录中没有数据文件夹,并且我假设没有 my.ini 文件包含有关数据目录所在位置的配置信息。我还使用 read 的 windows 安装程序安装了 MySql,这可能是没有 my.ini 文件而只有一个模板 my-default.ini 文件的原因。
有人知道为什么会这样吗?
【问题讨论】:
-
您可能希望在管理员命令提示符下执行此操作,另请参阅 stackoverflow.com/questions/26833642/…。
-
我尝试以管理员身份运行命令提示符,但这给出了相同的结果。但是,我按照您的链接和命令:“start> CMD> c:\Program Files\MySQL Server 5.7\bin> mysql -u root -p” 成功了!
标签: mysql