Add new user _ MySQL for MySQL database

Source: Internet
Author: User
Add a new user to the MySQL database. there is only one default user in the newly installed MySQL database. this is root @ localhost. if you need to make the database accessible and used by more users, to add a new user, you can use the following two methods in windows:

Use the GRANT statement:

Grant select on test. * to 'yonghu' @ '%' identified by 'some _ Pass' with grant option;

The example shows adding a user named yonghu from any location. the password is some_pass, which can be used to select any table in the test database.

Insert users directly to the grant table:

Shell> mysql -- user = root mysql

Mysql> insert into user (Host, User, Password) values ('localhost', 'shagua ','');

Mysql> flush privileges; indicates to add a user from the local machine named shagua with a blank password to the database.

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.