日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

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

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

推薦:MySQL編程中的6個(gè)實(shí)用技巧
每一行命令都是用分號(hào)(;)作為結(jié)束 對(duì)于MySQL,第一件你必須牢記的是它的每一行命令都是用分號(hào)(;)作為結(jié)束的,但當(dāng)一行MySQL被插入在PHP代碼中時(shí),最好把后面的分號(hào)省略掉,例如: 代碼如下: mysql_query(INSERT INTO tablename(first_name,last_name)VALUES('$first_na

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

 

代碼如下:
#/usr/libexec/mysqld --verbos --help

 

mysql5.5手冊(cè)說(shuō)明如下

 

代碼如下:
--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

 

代碼如下:
#mysqld_safe --skip-grant-tables &

 

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

 

代碼如下:
INSERT INTO user SET User='root',Host='localhost',ssl_cipher='',x509_issuer='',x509_subject='';

 

直接輸入mysql連接并添加權(quán)限,這時(shí)候是不能使用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版本,可能操作過(guò)程中sql語(yǔ)句或其他地方有不同,語(yǔ)句執(zhí)行完畢之后需要flush privileges ,還可能要重新登錄才行。

分享:Centos中徹底刪除Mysql(rpm、yum安裝的情況)
我用的centos6,mysql讓我整出了各種問(wèn)題,我想重裝一個(gè)全新的mysql,yum remove mysql-server mysql之后再install并不能得到一個(gè)干凈的mysql,原來(lái)的/etc/my.cnf依然沒(méi)變,datadir里面的數(shù)據(jù)已沒(méi)有任何變化,手動(dòng)刪除/etc/my.cnf,/usr/lib/mysql,/usr/share/mysql,

來(lái)源:模板無(wú)憂//所屬分類(lèi):MySQL教程/更新時(shí)間:2015-03-07
相關(guān)MySQL教程