Create a user and assign permissions to the mysql database

Source: Internet
Author: User

Create a user and assign permissions to the mysql database

Record the process of creating a database user for the new application and assigning permissions to the new user.

(1) Create a database travel_db

Create database 'travel _ db' default character set utf8 COLLATE utf8_general_ci;

(2) create a new user travelUser1, which only allows the user to access the travel_db Database

Create user 'traveluser1 ';

Update mysql. user set password = password ('pwd123 #. o') where User = 'traveluser1 ';

Flush privileges;

Show grants for 'traveluser1 ';

Grant select, update, delete, insert on travel_db. * to 'traveluser1 ';

Flush privileges;

Show grants for 'traveluser1 ';

(3) set rijiAppUser to perform all operations on the travel_db Database

Flush privileges;

Grant all on travel_db. * to 'traveluser1 ';

Show grants for 'traveluser1 ';

For mysql user settings, refer to the article on this site:

Mysql user management and permission settings

Related Article

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: 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.