国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql誤刪root用戶恢復方法

2024-07-24 13:06:48
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了mysql誤刪root用戶恢復方法,本文操作是在mysql5.5版本下完成,其它版本僅作參考,需要的朋友可以參考下
 

裝完數據庫清理一些默認賬號的時候不小心把root刪除了,flush privileges 之后的新 root 忘了grant任何權限,查看mysqld選項里面有個 −−skip-grant-tables

 

復制代碼代碼如下:

#/usr/libexec/mysqld --verbos --help

 

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 ,還可能要重新登錄才行。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 绥阳县| 武川县| 鞍山市| 桐乡市| 林州市| 呼和浩特市| 兰考县| 黑水县| 玛多县| 资讯 | 连城县| 布尔津县| 德阳市| 新昌县| 宣恩县| 扶余县| 德保县| 财经| 平果县| 盈江县| 广南县| 海丰县| 同江市| 吉隆县| 蚌埠市| 施秉县| 大同县| 凤冈县| 永昌县| 延长县| 镇沅| 鹤岗市| 浦北县| 宝丰县| 昭平县| 商城县| 宝坻区| 怀集县| 民丰县| 元江| 海淀区|