作者:admin人气:0来源:网吧系统下载站2015-08-03 09:32:52
长时间的对着电脑,造成了"神志不清",一不小心在Mysql下误操作了“revoke all on *.* from 'root'@'localhost'; ”,这个命令的意思就是删除mysql中最高权限的用户root的所有权限。因为本机mysql的密码为空,虽然依旧可以进去mysql,但再也不法执行修改操作。
解决方法:
1、首先杀掉mysql进程
#pkill mysql
2、以--skip-grant-tables方式启动
#/usr/local/mysql/bin/mysqld_safe --user mysql --skip-grant-tables&
3、更新的MYSQL.USER表的所有字段中为N的为Y
# /usr/local/mysql/bin/mysql 进入mysql
>use mysql;
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.user”表中 host为“localhost”和“%”都有root的所有权限。
host列是指定登录的ip,比如说 user=root host=192.168.1.1 ,这里的意思就是说,root用户只能通过 192.168.1.1的客户端去访问,而%则是个通配符, 如果host=192.168.1.%,那么就表示 只要是 ip为host=192.168.1.前缀的客户端都可以连接,那么host=%的话则表示所有ip都有权去连接,这也就是为什么在开启远程连接的时候,大部分人都直接把host改成%的缘故,因为省事。
继续阅读:Mysql
2017-03-1864位Win10怎么安装MySQL5.6.35
2017-01-18KB967723补丁导致MySQL频繁掉线无法连接
2017-01-16Mysql workbench(数据库设计设计工具)v6.3CE中文版
2017-01-11MySQL API 中文手册v5.1官方中文版
2016-12-07phpMyAdmin(mysql数据库管理工具) v4.6.5.2 多语言中文版
2016-11-28phpMyAdmin(mysql数据库管理工具) v4.6.5 多语言中文版
2016-09-26Navicat for MySQL(MySQL数据库管理工具)绿色免注册版
2016-08-25【网吧连锁】如何处理Pubwin连锁中心出现mysql错误?