Mysql reads and runs commands through documents to quickly add multiple users and databases to mysql _ MySQL

Source: Internet
Author: User
Mysql reads and runs commands through documents to quickly add multiple users and databases to mysql.

# Vi mysqlusers.txt

Create databaseDataname;
Grant all privileges onDataname. *Username@ Localhost identified'Password';
Flush privileges;

#/Usr/local/mysql/bin/mysql-u root-pPassword<Mysqlusers.txt

The blue italic part is the corresponding user name and password. to add multiple users and databases, you only need to copy the code in the middle and modify the corresponding location, for example:
Create databaseDataname1;
Grant all privileges onDataname1. *Username1> @ Localhost "identified'Password';
Flush privileges;

Create databaseDataname2;
Grant all privileges onDataname2. *Username2> @ Localhost "identified'Password';
Flush privileges;

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.