How to enable Remote Access MySQL
Sometimes, you want to manage your database from your web server without login to it. There is a way to do this is enabled Remote Access MySQL. So how do it?
1. Change MySQL configuration
By default, Remote Access MySQL was disabled, you need to enable this option via command:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Add comment (#) character inline #bind-address = 127.0.0.1. Save and close.
Restart your mysql service
sudo service mysql restart
2. Set access remotely permission for the root account.
Login to mysql server and run command below:
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘your_password’ WITH GRANT OPTION;
3. Enjoy!
Now, on the remote machine, I can login to the mysql server.