裝完數(shù)據(jù)庫清理一些默認(rèn)賬號(hào)的時(shí)候不小心把root刪除了,flush privileges 之后的新 root 忘了grant任何權(quán)限,查看mysqld選項(xiàng)里面有個(gè) −−skip-grant-tables
mysql5.5手冊說明如下
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
如果沒有root賬戶就添加一個(gè)
直接輸入mysql連接并添加權(quán)限,這時(shí)候是不能使用grant命令的,只能用update
注意我用的是mysql是5.5版本,可能操作過程中sql語句或其他地方有不同,語句執(zhí)行完畢之后需要flush privileges ,還可能要重新登錄才行。
新聞熱點(diǎn)
疑難解答
圖片精選