This article mainly introduces how to solve the problem that MySQL cannot connect remotely. the solution provided in this article is mainly for the case of IP address restrictions. if you need a friend, refer to the remote host, I have enabled the mysql service and can use phpmyadmin to open it. for example, the user name is root and the password is 123456. However, an error is reported during remote connection using the Mysql client. for example, Mysql-Front reports the following error.
Access denied for user ‘root'@'121.42.8.33′(using password:YES)
It is strange that phpmyadmin can be accessed normally, but why cannot Mysql-Front be connected? The possible cause is that the IP address is restricted. phpmyadmin uses localhost for connection, and the IP address of the remote host used only when we access the page, mysql-Front connects to a remote host.
The solution is as follows. we need to create a new user and grant all IP addresses the access permission.
In the following SQL statement, username is the user name, and password is the password you want to set:
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;CREATE USER 'username'@'%' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION; CREATE USER 'username'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
By executing the preceding statements, you can create a new account with username and password, and then log on with the new account.