>[danger]添加用户、授权。 # 数据库管理 ```sql -- 创建名称为“demo”数据库,并设定编码集为utf8 CREATE DATABASE IF NOT EXISTS demo DEFAULT CHARSET utf8 COLLATE utf8_general_ci; -- 创建用户dmp create user 'dmp'@'%' identified by 'dmp123456&'; -- 给dmp授权 grant all privileges on demo.* to 'dmp'@'%'; ``` ## 问题解决 授权时遇到了授权问题: ``` [SQL]grant all privileges on demo.* to 'dmp'@'%'; [Err] 1044 - Access denied for user 'root'@'%' to database 'demo' ``` 原因:root用户没有开启授权权限; 解决办法:[mysql中解决:Error Code: 1044. Access denied for user 'root'@'%' to database](https://blog.csdn.net/paullinjie/article/details/80343633)