300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > mysql误删root用户恢复方法【MySQL】

mysql误删root用户恢复方法【MySQL】

时间:2019-04-15 12:34:41

相关推荐

mysql误删root用户恢复方法【MySQL】

数据库|mysql教程

mysql,误删,root用户,恢复方法

数据库-mysql教程

装完数据库清理一些默认账号的时候不小心把root删除了,flush privileges 之后的新 root 忘了grant任何权限,查看mysqld选项里面有个 −−skip-grant-tables

家政服务门户源码sql下载,vscode大纲是什么,fd -h ubuntu,tomcat 设置欢迎页,数据爬虫副业,有什么php网站,seo优化外包找哪家,淘宝客网站后台,网络公司模板lzw

#/usr/libexec/mysqld –verbos –help

信用卡申请平台源码,vscode插入表格,ubuntu 16.04分区方案,tomcat马哥,vs调用sqlite,普通服务器和云服务器,输入框遮挡 插件,前端管理框架ui,网络爬虫爬取分页数据,php学习课程,广州网站seo优化公司,班级主页网站模板,哪里下载网页设计软件好,q a页面模板,好看的错误页面,access做的图书馆管理系统,折800程序lzw

中国地图 flash 源码,vscode 插件大全下载,ubuntu 停止用户,tomcat文件和jdk,爬虫过程分析,php多进程并发,关键词霸屏推广seo,有什么网站网站源码,帝国网站模板变量加图片lzw

mysql5.5手册说明如下

–skip-grant-tables

This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload command from a system shell, or by issuing a MySQL FLUSH PRIVILEGES statement after connecting to the server. This option also suppresses loading of plugins, user-defined functions (UDFs), and scheduled events. To cause plugins to be loaded anyway, use the –plugin-load option.

–skip-grant-tables is unavailable if MySQL was configured with the –disable-grant-options option. See Section 2.10.2, “Typical configure Options”.

mysqld_safe是Unix/Linux系统下的MySQL服务器的一个启动脚本。这个脚本增加了一些安全特性,会在启动MySQL服务器以后继续监控其运行情况,并在出现错误的时候重新启动服务器。后台启动mysql

#mysqld_safe –skip-grant-tables &

如果没有root账户就添加一个

INSERT INTO user SET User=’root’,Host=’localhost’,ssl_cipher=”,x509_issuer=”,x509_subject=”;

直接输入mysql连接并添加权限,这时候是不能使用grant命令的,只能用update

UPDATE user SET Select_priv=’Y’,Insert_priv=’Y’,Update_priv=’Y’,Delete_priv=’Y’,Create_priv=’Y’,Drop_priv=’Y’,Reload_priv=’Y’,Shutdown_priv=’Y’,Process_priv=’Y’,File_priv=’Y’,Grant_priv=’Y’,References_priv=’Y’,Index_priv=’Y’,Alter_priv=’Y’,Show_db_priv=’Y’,Super_priv=’Y’,Create_tmp_table_priv=’Y’,Lock_tables_priv=’Y’,Execute_priv=’Y’,Repl_slave_priv=’Y’,Repl_client_priv=’Y’,Create_view_priv=’Y’,Show_view_priv=’Y’,Create_routine_priv=’Y’,Alter_routine_priv=’Y’, Create_user_priv=’Y’,Event_priv=’Y’,Trigger_priv=’Y’,Create_tablespace_priv=’Y’,authentication_string=” WHERE User=’root’;

注意我用的是mysql是5.5版本,可能操作过程中sql语句或其他地方有不同,语句执行完毕之后需要flush privileges ,还可能要重新登录才行。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。