标签归档:database

MySQL命令方式便捷新增用户与数据库并授权访问

mysql> use mysql;
mysql> insert into user (Host,User,Password) values ('localhost','DB_USERNAME',password('DB_PASSWORD'));
mysql> flush privileges;
mysql> create database DB_NAME;
mysql> grant all privileges on DB_NAME.* to DB_USERNAME@localhost identified by 'DB_PASSWORD';
mysql> flush privileges;