Here we take the windows platform as an example.
When you do not configure any MySQL database and access MySQL remotely on another machine, you will report an error:
Command line remote login
mysql -h192.168.1.1 -uroot -p -P3306
1130 - Host 'xxxx' is not allowed to connect to this MySQL server
At this point, you will think whether you don’t have the right to add remote access to the user, so you connect to the remote machine, enter mysql, and use the
select user,host from mysql.user='root'It is found that the root user only has
grant all privileges on *.* to [email protected]'localhost' identified by '123456';
flush privileges;Refresh permissions.
net stop mysqlStop MySQL service
net start mysqlservice mysql start
Then log in again
select user,host from mysql.user='root'
I found that I have remote login permission
And then back to the remote host
If you use Navicat or log in remotely, you will still report an error and cannot log in.
Then I found more than n solutions on the Internet, but they still can’t.
Finally, use it again
net stop mysqlAfter that, enter the process management, and find that the MySQL service is still started…
So manually stop all the processes about mysql.
After that, start MySQL again. You can start it under the control panel management tools service or use it directly
net start mysqlStart.
At this point, you can log in to MySQL remotely,The main reason is that there is no real restart of MySQL server.
- Stop the server
net stop mysql
stay mysql.ini Add to file
[client] host=localhost User = "root" # for ordinary users, enter the user name Password = * * * "ා fill in the password corresponding to your MySQL root user After saving and exiting, restart MySQL database
- After stopping the server
Or add it to the file you just created
After restart, directly
mysql -uroot -pEnter and you can land.
This work adoptsCC agreementReprint must indicate the author and the link of this article