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.