mysql新加用户并赋予指定库的权限

连接mysql,mysql -uroot  (本机的root用户,无需密码,mysql -uroot -p    需要输入密码)

创建用户,create user 'user'@'%' identified by 'password'; %指的是可以在其他机器上连接,如果是localhost表示只可以本机访问。

赋与指定库的权限,grant all on baseName.* to 'user'@'%' identified by 'password';

刷新权限,flush privileges;

posted @ 2019-08-15 14:04  Dream's  阅读(238)  评论(0)    收藏  举报