Mysql-uroot-p allows local IP addresses to access localhost, 127001 insertintomysqluser (Host, User, Password) values (39; localhost39;, 39; zhouz39;, password (39; 123439;); allow external
# Mysql-u root-p # Allow local IP addresses to access localhost, 127.0.0.1 # insert into mysql. user (Host, User, Password) values ('localhost', 'zhouz', password ('000000'); # Allow Internet IP access # insert into mysql. user (Host, User, Password) values ('%', 'zhouz', password ('000000'); # refresh authorization # flush privileges; # create database zhouzdb default charset utf8 COLLATE utf8_general_ci; # grant all permissions to the database through the Internet IP address # grant all privileges on 'zhouzdb '. * to 'zhouz' @ '%' identified by '000000'; # grant all permissions to the database on the local server # grant all privileges on 'zhouzdb '. * to 'zhouz' @ 'localhost' identified by '000000'; # refresh permissions # flush privileges; # log out of root and log on again # \ q # log on to zhouz with a new account, because % arbitrary IP address is used for connection, you need to specify the external access IP address # mysql-u zhouz-h 192.168.1.168-p #1234
In normal times, it is rare to use the command line mode of mysql to operate. Today, we will create a new user authorization, and we will have some problems in this article.
Note: If only the internet access permission is enabled, local access is not allowed. if you need to allow access from the local server to mysql, you need to increase the local access permission.