mysql open the Remote access settings

MySql-Server for security considerations default only allows the machine (localhost, 127.0.0.1) to access the connection.

It is necessary to modify remote access permissions to the root

1. In connection with the server, the operating system database mysql

  Command: mysql -u root -p

root: the user name

                              use mysql;

2. Query User List

select  User,authentication_string,Host from user;

3. Add users and their privileges

1. GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'  

   123456 here to give you permission to add password set by the user,% represents all hosts can also be specific to your host ip address

 2.flush privileges;        

 This step must be done, or can not succeed! Phrase represents reload permission from the grant table mysql database data

 Because the MySQL privileges are placed in the cache, so the need to reload after the finish to change.

4. Remove the users and their privileges

delete from user where Host='%';

Guess you like

Origin www.cnblogs.com/sitian2050/p/11690922.html