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.

 

Support Our Threat Intelligence

If you find our technology report and cybersecurity news helpful, consider supporting our work.

Crypto QR Code
USDT (TRC20):
TN8BdV8cp4T1Cd28gK9qTAnZknzzuwyUtm
USDT (ERC20):
0x3725e1a7d3bc5765499fa6aaafe307fabcd75bce