摘自网络
create database test1;
1 | create database test1; |
创建完数据库后,通过远程连接提示
Access denied for user 'root'@'%' to database ‘xxxx’
1 | Access denied for user 'root' @ '%' to database ‘xxxx’ |
原因:创建完数据库后,需要进行授权,(在本地访问一般不会存在这个问题)。
解决办法:
执行授权
grant all on xxxx.* to 'root'@'%' identified by 'password' with grant option;
- xxxx代表创建的数据库;
- password为用户密码,在此为root的密码
1 | grant all on xxxx.* to 'root' @ '%' identified by 'password' with grant option; |
2 |
3 | xxxx代表创建的数据库; |
4 | password为用户密码,在此为root的密码 |
完成后即可11111