Enable Remote Access To MySQL under Linux

This is done under Ubuntu, but it almost the same for every version of Linux.

 

  1. Edit my.cnf File – you can find it with the locate command, usually under /etc/mysql/my.cnf.
  2. look for bind-address. found it? make sure this is indeed your server address on the network and not, lets say, 127.0.0.1…
  3. restart mysql (this is the exact command as well)
  4. Login to mysql from the terminal mysql -u root -p and then your password.
  5. create your db using create database command, e.g. create database test1;
  6. Now grant access to the user you want (this will create a user if not exists): GRANT ALL ON test1.* TO myuser@'192.168.0.11' IDENTIFIED BY 'PASSWORD';
  7. if you want myuser to be able to connect from any IP, you can just type: GRANT ALL ON test1.* TO myuser IDENTIFIED BY 'PASSWORD';and it will work.

Leave a Reply

You must be logged in to post a comment.


Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 17

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 17

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 45

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 45

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 47

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 47

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/content/61/4091161/html/wptalreg/wp-content/plugins/vsf-simple-stats/vsf_simple_stats_shutdown.php on line 47