December 7, 2016 18:44:06
-====------------------------
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). This command allows all the root user to enter the password login to the MySQL server, if the '% ' transfer ' 192.168.1.124 ', then only ' 192.168.1.124 ' host can log on 1, using the root user login to Linux, Log in to the root user of MySQL and change the range of IP addresses allowed to log in.
[Email protected] ~]# mysql-u root-p
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' password ' with GRANT option;
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;
2. 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) (the new version of Bind-address is bound to 0.0.0.0 without setting?). )
Note: netstat-apn| grep 3360 View 3306 Port status Finally, I found a strange thing. TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 3783/ Mysqld above the red place, the listening port is normal, but bind the local roundabout address, no wonder always connected, so looked up the following information, found the solution: Modify the MySQL configuration file/etc/mysql/ My.conf, the bind-address will be added to the remote access IP address or ban this sentence can let the remote machine login access.
Reboot (command below):
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
or restart or restart Apache or Nginx server (not recommended)
View Port Numbers
Show global variables like ' port ';
Sets the Navicat connection.
Click Connect Test to see that the following indicates success.
Linux command Navicat connect to MySQL database under Linux