Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: How to allow remote connection to mysql

I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source.

How can I do that?

like image 988
Leo Avatar asked Feb 08 '13 18:02

Leo


People also ask

How do I remotely connect to a database?

To set up remote connection to your database, go to Site Tools > Site > MySQL > Remote. After that fill in the IP address or hostname from which you want to connect. You can also add a Label for them. This will allow you to connect to the database server via a remote MySQL client.


1 Answers

That is allowed by default on MySQL.

What is disabled by default is remote root access. If you want to enable that, run this SQL command locally:

 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;  FLUSH PRIVILEGES; 

And then find the following line and comment it out in your my.cnf file, which usually lives on /etc/mysql/my.cnf on Unix/OSX systems. In some cases the location for the file is /etc/mysql/mysql.conf.d/mysqld.cnf).

If it's a Windows system, you can find it in the MySQL installation directory, usually something like C:\Program Files\MySQL\MySQL Server 5.5\ and the filename will be my.ini.

Change line

 bind-address = 127.0.0.1 

to

 #bind-address = 127.0.0.1 

And restart the MySQL server (Unix/OSX, and Windows) for the changes to take effect.

like image 180
mjuarez Avatar answered Oct 08 '22 14:10

mjuarez