Enable Remote Access in MySQL on Ubuntu/Linux

This is a short an simple tutorial on how to enable remote access on MySQL on Ubuntu/Debian:

      1. Edit the file /etc/mysql/my.cnf: at the line with: bind-address = …
      2. Replace 127.0.0.1 with your server’s IP address.
      3. Save the file!!!
      4. Log in to MySQL: mysql -u root -p

      1. Run command: GRANT ALL PRIVILEGES ON *.* TO ‘MY_USERNAME’@’12.34.56.78‘ IDENTIFIED BY ‘MY_PASSWORD’;
      2. Restart the MySQL server with the command: sudo /etc/init.d/mysql restart or restart mysql

 

Explanation:

 

*.* = (star point star) all databases, all tables
‘MY_USERNAME’ = the user to whom you wish to grant access
’12.34.56.78′ = the IP from where you will connect (for any IP use: ‘%’ )
‘MY_PASSWORD’ = the password of the user to whom you are granting access

 

Leave a Reply

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