MySQL 运行mysqld时出现问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33691038/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:23:57  来源:igfitidea点击:

Issue when running mysqld

mysql

提问by Youssef

I download mysql-5.7.9-winx64.zipand when i try to run mysqldi got this error :

我下载mysql-5.7.9-winx64.zip并尝试运行时mysqld出现此错误:

E:\Softwares\mysql-5.7.9-winx64\bin>mysqld
mysqld: Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off
logging for that application.
mysqld: Can't change dir to 'E:\Softwares\mysql-5.7.9-winx64\data\' (Errcode: 2 - No such file or directory)
2015-11-13T10:45:09.715411Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_ti
mestamp server option (see documentation for more details).
2015-11-13T10:45:09.731411Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of
 generated files. Consider setting it to a valid, non-empty path.
2015-11-13T10:45:09.732411Z 0 [ERROR] Cannot open Windows EventLog; check privileges, or start server with --log_syslog=0
2015-11-13T10:45:09.732411Z 0 [Note] mysqld (mysqld 5.7.9) starting as process 3532 ...
2015-11-13T10:45:09.864419Z 0 [Warning] Can't create test file E:\Softwares\mysql-5.7.9-winx64\data\yous-PC.lower-test
2015-11-13T10:45:09.864419Z 0 [Warning] Can't create test file E:\Softwares\mysql-5.7.9-winx64\data\yous-PC.lower-test
2015-11-13T10:45:09.864419Z 0 [ERROR] failed to set datadir to E:\Softwares\mysql-5.7.9-winx64\data\
2015-11-13T10:45:09.865419Z 0 [ERROR] Aborting

2015-11-13T10:45:09.865419Z 0 [Note] Binlog end
2015-11-13T10:45:09.945424Z 0 [Note] mysqld: Shutdown complete

采纳答案by solarie

try the MySQL Installer 5.7.9 to install it automatically mysql-installer-web-community-5.7.9.0.msi and it works.

尝试使用 MySQL Installer 5.7.9 自动安装它 mysql-installer-web-community-5.7.9.0.msi 并且它可以工作。

回答by user1660791

You must run the Command Prompt as administrator. Then run mysqld.

您必须以管理员身份运行命令提示符。然后运行mysqld。

To do this right click the Command Prompt startup icon and then select Run As Admininistrator. Then run mysqld and you should no longer see that error.

为此,请右键单击命令提示符启动图标,然后选择以管理员身份运行。然后运行 ​​mysqld,你应该不会再看到那个错误了。

mysqld needs access to your registry the first time. you do not have to do this after the first time.

mysqld 第一次需要访问您的注册表。在第一次之后,您不必执行此操作。

回答by Martin Pabst

For development/debugging purposes i need a MySQL-Server without installation and don't want it to change my windows installation, e.g. by setting registry keys. MySQL's hint "start server with --log_syslog=0" works well:

出于开发/调试目的,我需要一个没有安装的 MySQL 服务器,并且不希望它改变我的 Windows 安装,例如通过设置注册表项。MySQL 的提示“使用 --log_syslog=0 启动服务器”效果很好:

mysqld -u root --log_syslog=0

回答by malyy

Windows operating system will not allow you to make changes in certain system critical registry keys. Nevertheless, if you want to make changes even in such registry keys, you will have to take full control of these keys before Windows will allow you to make or save the changes.

Windows 操作系统不允许您更改某些系统关键注册表项。尽管如此,如果您甚至想对此类注册表项进行更改,则必须在 Windows 允许您进行或保存更改之前完全控制这些注册表项。

check this link: http://www.thewindowsclub.com/how-to-take-full-control-of-windows-7-registry-keys

检查此链接:http: //www.thewindowsclub.com/how-to-take-full-control-of-windows-7-registry-keys

回答by JavaMaMocha

I ran into the same problem on a Windows machine. I tried to "Run as Administrator" and change the path, but nothing prevailed.

我在 Windows 机器上遇到了同样的问题。我尝试“以管理员身份运行”并更改路径,但没有成功。

It turned out Mysql wasn't reading the "my.ini" file. I solved the problem by putting the "my.ini" file into the C:/Windows directory as it was pointed out in the official MySQL troubleshoot guide HERE

原来 Mysql 没有读取“my.ini”文件。我通过将“的my.ini”文件到C解决了这个问题:/ Windows目录,因为它是MySQL官方排查指南中指出HERE

回答by user7395342

Use basedir = C:/myfolder/mysql-5.7.11-winx64then find cmd.exefor the path: C:\Windows\System32\cmd.exe.

使用basedir = C:/myfolder/mysql-5.7.11-winx64然后查找cmd.exe路径:C:\Windows\System32\cmd.exe

In order to do this, right click the Command Prompt startup icon and then select "Run As Admininistrator".

为此,请右键单击命令提示符启动图标,然后选择“以管理员身份运行”。

回答by Lizi Z

I run into both log error and data folder misconfig issues like you have.

我遇到了像您一样的日志错误和数据文件夹错误配置问题。

Here is my solution:

这是我的解决方案:

  • Run the Command Prompt as administrator. Then run mysqld. - (just like user1660791 suggested)
  • For the path error, you need to make sure to \ instead of \ for path. Example as below: basedir = C:\\myfolder\\mysql-5.7.11-winx64
  • 以管理员身份运行命令提示符。然后运行mysqld。- (就像 user1660791 建议的那样)
  • 对于路径错误,您需要确保使用 \ 而不是 \ 作为路径。示例如下: basedir = C:\\myfolder\\mysql-5.7.11-winx64

Have to post this as new answer due to i don't have permission comment of others post.

由于我没有其他帖子的许可评论,因此必须将此作为新答案发布。