1.恢复MYSQL的root用户
不小心把root的localhost权限给删除了,结果无法在服务器上以root用户登录,参考网上资料,解决方法如下:
1.
KILL 掉 mysql的守护进程。
2.
跳过权限表启动
./bin/safe_mysqld --skip-grant-tables &
3.
use mysql
select host,user
from user;
发现还存在root的127.0.0.1,这下好了,密码都不用修改,直接把插入表
insert user select 'localhost',User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv
,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv
,Create_view_priv,Show_view_priv ,Create_routine_priv
,Alter_routine_priv,Create_user_priv,ssl_type,ssl_cipher,x509_issuer,x509_subject,max_questions
,max_updates ,max_connections,max_user_connections from user where host="127.0.0.1";或者直接用grant重新给root设置个密码。
grant all privileges on *.* to root@localhost identified by "XXXX";
flush privileges;
4.重启mysql服务
5.
以root用户登录
./mysql –u root –p’XXXX’
OK,到此搞定。
阅读(595) | 评论(0) | 转发(0) |