A default installation of MySQL server on a Linux machine will only listen for connections on the local interface (localhost or 127.0.0.1), so any remote connections can not be established.
This how to article outlines the steps to change the configuration to listen on a specific, or all interfaces on the machine.
Open the MySQL configuration file (my.cnf) in a text editor:
$ sudo nano /etc/mysql/my.cnf
This configuration file is split into sections. The section we want is the “[mysqld]” section.
Find the setting “bind-address” under the “[mysqld]” section.
By default, it will look like this:
bind-address = 127.0.0.1
This needs to be changed to either a specific IP address that you want MySQL to listen on, or to 0.0.0.0 to listen on all interfaces/IP’s associated with the machine.
Eg:
bind-address = 0.0.0.0
Save the file and exit the editor.
Restart MySQL to activate these changes:
$ sudo service mysql restart
You should now be able to connect to the MySQL server from another PC.
Make sure you set up the required permissions for the users and databases if they need to be able to connect to the MySQL server remotely. Generally users will only be allowed to login from localhost unless they have been configured otherwise.