If you are trying to access your database server remotely and getting below error during MySQL login:
Error:
Then this article will help you to resolve this issue. In this article I will show you how to fix this error.
Mostly this error comes when your root user only have been added with localhost access. You can check using below command, first of all go to your mysql database server and type the below command to check:
mysql> SELECT host FROM mysql.user WHERE User = 'root'; +-----------+ | host | +-----------+ | 127.0.0.1 | | ::1 | | localhost | +-----------+ 3 rows in set (0.00 sec)
As you can see that root is only allowed from localhost 127.0.0.1. you cannot connect from an external source. If you see other IP addresses.
Next You will need to add the IP address of each system that you want to grant access to, and then grant privileges like below:
CREATE USER 'root'@'ip_address' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'ip_address';
You can also allow your root to connect from any remote source use the below command:
CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
Finally, reload the permissions, and you should be able to have remote access:
FLUSH PRIVILEGES;
If still you are getting same error check open your my.cnf file and check for below line:
bind-address = 127.0.0.1
Now Comment out the bind address from the file /etc/mysql/my.cnf.
#bind-address = 127.0.0.1
Next restart mysqld service to apply above changes.
# /etc/init.d/mysqld restart
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
i do this intruction and finding many website from google but still cant connect, whta problem with mine?
Hey There. I found your blog using msn. This is an extremely well written article.
I’ll be sure to bookmark it and return to read
more of your useful information. Thanks for the post.I’ll certainly comeback.
Thank you so much sir