mysql数据库为单个用户创建用户数据库

CREATE DATABASE IF NOT EXISTS dbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create user 'user'@'%' identified by 'pwd';
GRANT ALL PRIVILEGES ON dbname.* TO 'user'@'localhost' IDENTIFIED BY 'pwd';
FLUSH   PRIVILEGES; 

查看用户权限

show grants for user@'localhost';

你可能感兴趣的:(mysql数据库为单个用户创建用户数据库)