Remotely connect to mysql server using workbench

 By default mysql server disallow remote connection. To enable remove connection you need to follow below instruciton:

Goto this file /etc/mysql/mysql.conf.d/mysqld.cnf and open it using following command:

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf and change following bind-address = 127.0.0.1 to bind-address = 0.0.0.0 or your specific IP address.

Then restart mysql server : sudo service mysql restart


Now login to mysql as root user :
# mysql -u root -p

and create a new user: 

CREATE USER 'newuser'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'%';

FLUSH PRIVILEGES;


Now it's time to connect  mysql from remote machine :

 
# mysql -u newuser -h MYSQL_SERVER_IP -p

Make sure that 3306 port is open for mysql to remote connection.

Now connect using mysql workbench with following screenshot:




Post a Comment

0 Comments