问题
Everything was working fine, I had Windows 8 and MySQL 5.6 workbench.
Yesterday, I upgraded to Windows 8.1 which made the PC run better but messed up the 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.
回答1:
Well, Uninstalling workbench and re-installing it did the trick. All Schemas were not deleted
回答2:
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!
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.
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.
Hey presto, your databases and user credentials are back.
回答3:
After upgrade to Windows 8.1 you either need to run the MySQL config wizard
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.
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;
回答4:
In my case, the service of mysql was missing. Reinstalling the service with the following command:
mysqld --install [Instance Name] --defaults-file=[My SQL Configuration File]
so, if my install the service, with MySQL
is the instance name, and D:\MySQL\my.ini
was my previous configuration file, I executed the following command:
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.
来源:https://stackoverflow.com/questions/19514279/mysql-not-working-after-updating-to-windows-8-1