mysql新增数据库新增用户并授权用户
-- 创建数据库
CREATE DATABASE baseName;
-- 创建用户
CREATE USER 'userName' @ '访问限制' IDENTIFIED BY 'password';
-- 授权用户
GRANT ALL PRIVILEGES ON 数据库名称.表名称 TO 'userName'@'访问限制';
-- 刷新用户权限
FLUSH PRIVILEGES;
---修改用户密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword';
demo 示范:
CREATE USER 'honeyJean'@'localhost' IDENTIFIED BY 'passwordString';
GRANT ALL PRIVILEGES ON zhoulujun.* TO 'honeyJean'@'localhost';
FLUSH PRIVILEGES;
记住:@两边不要有空格