位置:海鸟网 > IT > mySQL >

快速批量添加mysql账户方法

待执行的SQL文件(createuser.sql)–批量添加mysql账户的语句

grant all privileges on sq_hehe.* to hehe@localhost identified by “heiq”;
grant all privileges on sq_eili.* to
eili@localhost identified by “eiglia”;


grant all privileges on sq_bob* to
bob@localhost identified by “bo2esql”;
grant all privileges on sq_7car.* to
7car@localhost identified by “77sq”;

flush privileges;

执行createuser.sql文件中的语句:

mysql -u用户名  -p密码  -h主机地址(localhost) < createuser.sql