更新到 Windows 8.1 后 MySQL 不工作

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

MySQL not working after updating to Windows 8.1

mysqlmysql-workbench

提问by Bergkamp

Everything was working fine, I had Windows 8 and MySQL 5.6 workbench.

一切正常,我有 Windows 8 和 MySQL 5.6 工作台。

Yesterday, I upgraded to Windows 8.1 which made the PC run better but messed up the MySQL.

昨天,我升级到 Windows 8.1,这使 PC 运行得更好,但搞砸了 MySQL。

When I enter the workbench I can see my old connection but by clicking on it I get:

当我进入工作台时,我可以看到我的旧连接,但通过单击它,我得到:

Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at 
127.0.0.1:3306:Can't connect to mysql server on '127.0.0.1'(10061)
Please:
 1. Check that mysql is running on server 127.0.0.1
 2. Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
 3. Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines) 
 4. Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from the host address you're connecting from.

采纳答案by Bergkamp

Well, Uninstalling workbench and re-installing it did the trick. All Schemas were not deleted

好吧,卸载工作台并重新安装它就成功了。未删除所有架构

回答by G. Stewart

Reinstalling the mysqld service will indeed get the database server to start up again, but you will find that your databases are missing, as are all your user details!

重新安装mysqld服务确实会让数据库服务器再次启动,但是你会发现你的数据库丢失了,你所有的用户详细信息也丢失了!

Under Windows 8, MySQL stores its databases under C:\ProgramData\MySQL\MySQL Server 5.5\data while under 8.1 it has all moved to C:\Program Files\MySQL\MySQL Server 5.5\data.

在 Windows 8 下,MySQL 将其数据库存储在 C:\ProgramData\MySQL\MySQL Server 5.5\data 下,而在 8.1 下,它已全部移至 C:\Program Files\MySQL\MySQL Server 5.5\data。

The quick solution to this is:

对此的快速解决方案是:

  • Stop the mysqld service via MySQL Notifier in the task bar
  • Copy C:\ProgramData\MySQL\MySQL Server 5.5 to C:\Program Files\MySQL\MySQL Server 5.5
  • Restart the mysqld service via the Notifier.
  • 通过任务栏中的 MySQL Notifier 停止 mysqld 服务
  • 将 C:\ProgramData\MySQL\MySQL Server 5.5 复制到 C:\Program Files\MySQL\MySQL Server 5.5
  • 通过通知程序重新启动 mysqld 服务。

Hey presto, your databases and user credentials are back.

您好,您的数据库和用户凭据又回来了。

回答by rupweb

After upgrade to Windows 8.1 you either need to run the MySQL config wizard

升级到 Windows 8.1 后,您需要运行 MySQL 配置向导

http://dev.mysql.com/doc/refman/5.1/en/mysql-config-wizard-starting.html

http://dev.mysql.com/doc/refman/5.1/en/mysql-config-wizard-starting.html

But I could not get that to work, so had to reinstall the MySQL Server.

但我无法让它工作,所以不得不重新安装 MySQL 服务器。

Then to install it as a service, and point to my earlier databases:

然后将其安装为服务,并指向我之前的数据库:

mysqld --install MySQL --defaults-file=C:\MySQL\data\my.ini

Check it's working by running

通过运行检查它是否正常工作

mysql -u username -p password
show databases;

回答by Syakur Rahman

In my case, the service of mysql was missing. Reinstalling the service with the following command:

就我而言,缺少 mysql 服务。使用以下命令重新安装服务:

mysqld --install [Instance Name] --defaults-file=[My SQL Configuration File]

so, if my install the service, with MySQLis the instance name, and D:\MySQL\my.iniwas my previous configuration file, I executed the following command:

所以,如果我安装了服务,withMySQL是实例名称,D:\MySQL\my.ini是我以前的配置文件,我执行了以下命令:

mysqld --install MySQL --defaults-file="D:\MySQL\my.ini"

Then start the service as usual. That should do the trick.

然后照常启动服务。这应该够了吧。

Note: You have to execute those command in a command prompt with elevated privilege.

注意:您必须在具有提升权限的命令提示符中执行这些命令。