Suppose you installed MySQL server on your Linux box.
Suppose you need to let access to the server from applications outside the host.
In this case you need to configure remote access.
In the file /etc/my.cnf you need to comment skip-network option and you need to assign bind option as following:
but if you have more network cards and you need to reduce access to a single network you need something more specific.
Suppose you need to have the 192.168.0.0/24 netwok enabled access to MySQL server.
Just specify your IP address box in the bind option:
How to enable external hosts to access to your MySQL? The default configuration won’t let you do it.
You should create a MySQL user and give it the correct grants.
You can choose if let access any host in that network or if let access just one or more specific hosts.
In less restrictive access you can simply do in this way from your MySQL console:
CREATE USER 'mysqluser'@'%' IDENTIFIED BY 'aC0MPL3XPa33W0RD';
GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' WITH GRANT OPTION;
mysqluser with the password
aC0MPL3XPa33W0RD. And you can connect to MySQL server from any host in the network.
If you want specify just one IP address to accept incoming connection do in this other way.
Open a MySQL console and add, for example, 192.168.0.12 host IP address, giving the command:
mysql -u root -p
MySQL server will ask you a root password:
In the console give these commands:
mysql> CREATE USER 'mysqluser'@'192.168.0.12
' IDENTIFIED BY 'aC0MPL3XPa33W0RD';
mysql> GRANT ALL ON *.* to mysqluser@'192.168.0.12'
WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;