Reprint: http://www.cnblogs.com/fnlingnzb-learner/p/5830661.html
If MySQL is installed and set up as per the previous method, it is a little easier to connect remotely. I will combine some articles on Baidu to analyze.
Local Computer ip:192.168.1.100
remote computer ip:192.168.1.244
Connect the Linux system remotely to ensure that the Linux system is installed on the MySQL database. Log in to the database. Mysql-uroot-p (password).
- Create a user to connect remotely
GRANT all privileges on * * to ' itoffice ' @ ' percent ' identified by ' Itoffice ' with GRANT OPTION;
(The first itoffice represents the user name,% means that all computers can connect, you can set an IP address to run the connection, and the second itoffice represents a password).
- execute flush privileges; command takes effect immediately
- the user who queried the database (see the following indicating that the creation of the new user succeeded)
SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;
Exit MySQL using the exit command
Then open vim/etc/mysql/my.cnf.
Will bind-address = 127.0.0.1
Set to Bind-address = 0.0.0.0 (device address)
Reboot (command below):
/etc/init.d/mysql stop
/etc/init.d/mysql start
- View Port Numbers
Show global variables like ' port ';
- sets the Navicat connection.
- Click Connect Test to see that the following indicates success.
Note the problem:
1) I often display cannot connect to MySQL server when I enter Mysql-u root-p ... This error was later discovered to be that no MySQL was turned on. So before you do this, remember to check that MySQL has no open:
2) After the above connection, I use Navicat remote connection MySQL, found or not, tinker for a long time, only to find that because of the firewall problem, the firewall to the 3306 Port Shield. So to set up a firewall:
Set up firewall allow 3306 Port vi/etc/sysconfig/iptables add-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT ( Note Before you add the-a rh-firewall-1-input-j reject–reject-with icmp-host-prohibited, it may cause the rule not to take effect) to restart the Firewall service iptables restart
Troubleshoot problems with MySQL not being able to connect remotely
1, MySQL port is correct
View port occupancy through NETSTAT-NTLP , typically 3306 for the lower end. The use of the tool to connect to MySQL is to use the port. For example, My admin\my Query browser\mysql front and so on.
2. Check whether the user rights are correct
The user table of the MySQL library has two records: host is localhost and% (for security,% can be replaced with IP you need to connect externally).
Remote connection to MySQL under Linux (go)