New MySQL Users and database access authorization _ MySQL

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.