Mysql quickly adds multiple users and databases to mysql by reading and executing commands through documents

Source: Internet
Author: User
This article describes how to quickly add multiple users and database skills to mysql by reading and executing commands in mysql. For more information, see the following code:


# Vi mysqlusers.txt
Create database dataname;
Grant all privileges on dataname. * to username @ localhost identified by 'password ';
Flush privileges;
#/Usr/local/mysql/bin/mysql-u root-p password <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:

The code is as follows:


Create database dataname1;
Grant all privileges on dataname1. * to username1> @ localhost "identified by 'password ';
Flush privileges;
Create database dataname2;
Grant all privileges on dataname2. * to username2> @ localhost "identified by 'password ';
Flush privileges;

The above content will share with you how to quickly add multiple users and databases to mysql by reading and executing commands through the mysql documentation. I hope you will like it. please keep an eye on this site for the database content, new content is updated on this site every day.

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.