Configuring MySQL to be accessed from another machines

First, install MySQL server:

sudo apt update
sudo apt install mysql-server

Now, edit the config file:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Edit this on the file:

bind-address = 0.0.0.0

Now lets add password to root user:

sudo mysql -u root

Now run the following commands:

mysql> USE mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'remote'@'%' IDENTIFIED BY 'safe_password' WITH GRANT OPTION;
mysql> flush privileges;
mysql> quit;

Then, restart MySQL service:

sudo systemctl restart mysql

 

Leave a Reply

Your email address will not be published. Required fields are marked *