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

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql誤刪root用戶恢復(fù)方法

2020-01-18 23:00:34
字體:
供稿:網(wǎng)友

裝完數(shù)據(jù)庫清理一些默認(rèn)賬號(hào)的時(shí)候不小心把root刪除了,flush privileges 之后的新 root 忘了grant任何權(quán)限,查看mysqld選項(xiàng)里面有個(gè) −−skip-grant-tables

復(fù)制代碼 代碼如下:

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

mysql5.5手冊說明如下

復(fù)制代碼 代碼如下:

--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系統(tǒng)下的MySQL服務(wù)器的一個(gè)啟動(dòng)腳本。這個(gè)腳本增加了一些安全特性,會(huì)在啟動(dòng)MySQL服務(wù)器以后繼續(xù)監(jiān)控其運(yùn)行情況,并在出現(xiàn)錯(cuò)誤的時(shí)候重新啟動(dòng)服務(wù)器。后臺(tái)啟動(dòng)mysql

復(fù)制代碼 代碼如下:

#mysqld_safe --skip-grant-tables &

如果沒有root賬戶就添加一個(gè)

復(fù)制代碼 代碼如下:

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

直接輸入mysql連接并添加權(quán)限,這時(shí)候是不能使用grant命令的,只能用update

復(fù)制代碼 代碼如下:

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語句或其他地方有不同,語句執(zhí)行完畢之后需要flush privileges ,還可能要重新登錄才行。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 镇雄县| 黄平县| 万全县| 绥芬河市| 溧水县| 洞口县| 仙居县| 平邑县| 渭源县| 沾益县| 调兵山市| 麻江县| 灯塔市| 南雄市| 建德市| 安泽县| 天津市| 观塘区| 绥宁县| 辽阳市| 东山县| 深州市| 抚顺县| 柳江县| 永定县| 台南市| 额敏县| 定州市| 石柱| 交口县| 蚌埠市| 三台县| 宜宾县| 青冈县| 静海县| 定安县| 滕州市| 天全县| 东宁县| 上杭县| 互助|