新聞中心
在安裝軟件時(shí),需要用到Mysql數(shù)據(jù)庫(kù),要在里面建一個(gè)數(shù)據(jù)庫(kù),及相應(yīng)的用戶(hù),執(zhí)行建庫(kù)腳本,很順利,數(shù)據(jù)庫(kù)成功建好,但在執(zhí)行用戶(hù)授權(quán)時(shí)錯(cuò)誤就產(chǎn)生了:

邳州網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,邳州網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為邳州數(shù)千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的邳州做網(wǎng)站的公司定做!
- createdatabasecactidb;
- grantalloncactidb.*toroot@localhost;
- grantalloncactidb.*tocactiuser;
本來(lái)這是沒(méi)什么的,但我之前已經(jīng)把root@localhost這個(gè)用戶(hù)給刪除了,我只留下了用戶(hù)名為root,host是%的用戶(hù),而我平常的操作為了方便都只是用root在本機(jī)登錄的,我的mysql也只監(jiān)聽(tīng)127.0.0.1這個(gè)地址,結(jié)果一執(zhí)行g(shù)rantalloncactidb.*toroot@localhost;這個(gè)命令立即完蛋了,我在本機(jī)用root登錄就只能是root@localhost這個(gè)用戶(hù)的權(quán)限,而不是一平常用的root@%這個(gè)用戶(hù),但root@localhost基本就是沒(méi)有權(quán)限,按照Mysql的授權(quán)機(jī)制,我只有在其它主機(jī)登錄才可使用root@%這個(gè)用戶(hù),而我根本就不可能從其它地址登錄,這下把我給急壞了。由于嚴(yán)格的防火墻策略,我是不可能開(kāi)放mysql的端口的。后來(lái)在網(wǎng)上找了相關(guān)資料,用以下方法解決了這個(gè)問(wèn)題:
1、關(guān)閉mysql服務(wù):servicemysqldstop。
2、./mysqld_safe--skip-grant-tables重新啟動(dòng)mysql。
3、重新使用root登錄,此時(shí)不需要密碼。
4、登錄后刪除root@local這個(gè)用戶(hù)。
5、用ps查到mysqld進(jìn)程,并用kill中止mysql進(jìn)程。
6、重新啟動(dòng)mysql進(jìn)程:servicemysqldstart。
7、當(dāng)然使用這個(gè)方法也可重置root密碼:setpasswordforroot=password(yourpass');
8、或者也可以重置root用戶(hù)權(quán)限。
- updatedbsetSelect_priv='Y'whereuser='root';
- updatedbsetInsert_priv='Y'whereuser='root';
- updatedbsetUpdate_priv='Y'whereuser='root';
- updatedbsetDelete_priv='Y'whereuser='root';
- updatedbsetCreate_priv='Y'whereuser='root';
- updatedbsetDrop_priv='Y'whereuser='root';
- updatedbsetReferences_priv='Y'whereuser='root';
- updatedbsetGrant_priv='Y'whereuser='root';
- updatedbsetIndex_priv='Y'whereuser='root';
- updatedbsetAlter_priv='Y'whereuser='root';
- updatedbsetCreate_tmp_table_priv='Y'whereuser='root';
- updatedbsetLock_tables_priv='Y'whereuser='root';
- updatedbsetCreate_view_priv='Y'whereuser='root';
- updatedbsetGrant_priv='Y'whereuser='root';
- updatedbsetShow_view_priv='Y'whereuser='root';
- updatedbsetCreate_routine_priv='Y'whereuser='root';
- updatedbsetAlter_routine_priv='Y'whereuser='root';
- updatedbsetExecute_priv='Y'whereuser='root';
再把mysql.user表里root用戶(hù)的所有字段都置為'Y'。
注意:使用--skip-grant-tables啟動(dòng)mysql時(shí)不可使用grant命令的,所以只有我們手工來(lái)設(shè)置權(quán)限表了。
關(guān)于MySQL權(quán)限表的問(wèn)題就介紹到這里,如果大家想了解更多關(guān)于MySQL數(shù)據(jù)庫(kù)的知識(shí),不妨到這里看一下:http://database./mysql/,一定會(huì)讓您滿(mǎn)意的哦!
【編輯推薦】
- 利用mysql的audit審計(jì)功能記錄用戶(hù)操作信息
- MySQL索引背后的數(shù)據(jù)結(jié)構(gòu)及算法之索引實(shí)現(xiàn)
- Facebook對(duì)MySQL依賴(lài)的后果將是“比死還糟
- 詳解Discuz_WIN7_Apache_MySQL_PHP平臺(tái)搭建
- MySQL錯(cuò)誤:Can'tconnecttoMySQLserver(10060)
網(wǎng)站題目:MySQL數(shù)據(jù)庫(kù)用戶(hù)權(quán)限表丟失的解決方案
文章位置:http://m.5511xx.com/article/cdjgppc.html


咨詢(xún)
建站咨詢(xún)
