1.题目形貌
环境一: Navicat连接远程mysql数据库,创建数据库时出现错误:
环境二: 在linux中下令创建数据库出现如下报错:
2.原因分析
root权限不够,先利用“SELECT host,user,Grant_priv,Super_priv FROM mysql.user;”查询,发现已经是Y了。
通过SELECT * FROM mysql.user;下令查询权限信息,可以看到root对应的很多权限都是N,如下图所示:
至于为什么会出现root权限不够,大概是安装mysql的时间MySQL权限配置不精确,或者修改了干系的配置文件等。
3.办理方案
将root权限全部修改为Y,执行如下代码(记得退出mysql,重启服务):
修改权限
- use mysql;
- update user set Update_priv ='Y' where user = 'root';
- update user set Select_priv ='Y' where user = 'root';
- update user set Insert_priv ='Y' where user = 'root';
- update user set Update_priv ='Y' where user = 'root';
- update user set Delete_priv ='Y' where user = 'root';
- update user set Create_priv ='Y' where user = 'root';
- update user set Drop_priv ='Y' where user = 'root';
- update user set Reload_priv ='Y' where user = 'root';
- update user set Shutdown_priv ='Y' where user = 'root';
- update user set Process_priv ='Y' where user = 'root';
- update user set File_priv ='Y' where user = 'root';
- update user set Grant_priv ='Y' where user = 'root';
- update user set References_priv ='Y' where user = 'root';
- update user set Index_priv ='Y' where user = 'root';
- update user set Alter_priv ='Y' where user = 'root';
- update user set Show_db_priv ='Y' where user = 'root';
- update user set Super_priv ='Y' where user = 'root';
- update user set Create_tmp_table_priv ='Y' where user = 'root';
- update user set Lock_tables_priv ='Y' where user = 'root';
- update user set Execute_priv ='Y' where user = 'root';
- update user set Repl_slave_priv ='Y' where user = 'root';
- update user set Repl_client_priv ='Y' where user = 'root';
- update user set Create_view_priv ='Y' where user = 'root';
- update user set Show_view_priv ='Y' where user = 'root';
- update user set Create_routine_priv ='Y' where user = 'root';
- update user set Alter_routine_priv ='Y' where user = 'root';
- update user set Create_user_priv ='Y' where user = 'root';
- update user set Event_priv ='Y' where user = 'root';
- update user set Trigger_priv ='Y' where user = 'root';
复制代码 退出mysql
重启mysql服务
如图所示:修改成功
4.验证
已经可以创建表了
参考帖子:https://tencentcloud.csdn.net/64e5cfb5a3cccc782cc56451.html
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |