How Do I Configure MySQL for Remote Access?
I want to be able to remotely access the MySQL on my Linode. How can I configure this?
3 Replies
Hey there!
MySQL, under its default installation, will allow you to remotely access it. What you may run into, however, is remotely accessing MySQL with root access. If this is something you want to enable, run this SQL command on the Linode:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
You will also then want to access the configuration file typically found at /etc/mysql/my.cnf
and comment out the line that says bind-address = 127.0.0.1'. To clarify, you do this by adding a # in front of the line so it reads
#bind-address = 127.0.0.1'.
It is possible you will need to reset all the root passwords for MySQL as well. You do this by running the following command while logged into your Linode by running the following commands:
use mysql;
update user set password=PASSWORD("NEWPASSWORD") where User='root';
flush privileges;
Make sure to restart MySQL. After you have done this, you can check to make sure MySQL is listening on port 3306 by running either netstat -plunt
or ss plunt
depending on your distribution. You will likely see a result that includes the following:
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN <PID>/mysqld
I hope this helps!
How can I run these SQL Command from my windows client machine?
Currently I am using putty, but when I tried to run the commands, the problem has not resolved.