Friday, 19 September 2014

MySQL: Allowed to remote connect to MySQL server

MySQL Error : Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
How to fix it ?

STEP 1: Change mysql config :

vi /etc/mysql/my.cnf
Comment out following lines or edit to your client ip :
#bind-address           = 127.0.0.1
#skip-networking
Restart mysql server:
service mysql restart
STEP 2: Change GRANT privilege :

Login MySQL using command line .
Then run a command like below to grant access for user. Replace 'username' and 'password' with your username and password.
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
* '%' mean you can remote access from any ip address, You can replace it with a specified ip address.

Then flush MySQL :
FLUSH PRIVILEGES;

If it's still not working. Let's check your server firewall (iptables ...) and client firewall (windows firewall, antivirus software)


0 nhận xét:

Post a comment