自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL數(shù)據(jù)庫(kù)用戶權(quán)限表丟失的解決方案

數(shù)據(jù)庫(kù) MySQL
本文主要介紹了MySQL數(shù)據(jù)庫(kù)用戶權(quán)限丟失的修復(fù)方法,接下來(lái)就讓我們來(lái)一起學(xué)習(xí)一下吧。

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

  1. createdatabasecactidb;  
  2.  
  3. grantalloncactidb.*toroot@localhost;  
  4.  
  5. grantalloncactidb.*tocactiuser; 

本來(lái)這是沒什么的,但我之前已經(jīng)把root@localhost這個(gè)用戶給刪除了,我只留下了用戶名為root,host是%的用戶,而我平常的操作為了方便都只是用root在本機(jī)登錄的,我的mysql也只監(jiān)聽127.0.0.1這個(gè)地址,結(jié)果一執(zhí)行g(shù)rantalloncactidb.*toroot@localhost;這個(gè)命令立即完蛋了,我在本機(jī)用root登錄就只能是root@localhost這個(gè)用戶的權(quán)限,而不是一平常用的root@%這個(gè)用戶,但root@localhost基本就是沒有權(quán)限,按照Mysql的授權(quán)機(jī)制,我只有在其它主機(jī)登錄才可使用root@%這個(gè)用戶,而我根本就不可能從其它地址登錄,這下把我給急壞了。由于嚴(yán)格的防火墻策略,我是不可能開放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è)用戶。

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用戶權(quán)限。

  1. updatedbsetSelect_priv='Y'whereuser='root';  
  2.  
  3. updatedbsetInsert_priv='Y'whereuser='root';  
  4.  
  5. updatedbsetUpdate_priv='Y'whereuser='root';  
  6.  
  7. updatedbsetDelete_priv='Y'whereuser='root';  
  8.  
  9. updatedbsetCreate_priv='Y'whereuser='root';  
  10.  
  11. updatedbsetDrop_priv='Y'whereuser='root';  
  12.  
  13. updatedbsetReferences_priv='Y'whereuser='root';  
  14.  
  15. updatedbsetGrant_priv='Y'whereuser='root';  
  16.  
  17. updatedbsetIndex_priv='Y'whereuser='root';  
  18.  
  19. updatedbsetAlter_priv='Y'whereuser='root';  
  20.  
  21. updatedbsetCreate_tmp_table_priv='Y'whereuser='root';  
  22.  
  23. updatedbsetLock_tables_priv='Y'whereuser='root';  
  24.  
  25. updatedbsetCreate_view_priv='Y'whereuser='root';  
  26.  
  27. updatedbsetGrant_priv='Y'whereuser='root';  
  28.  
  29. updatedbsetShow_view_priv='Y'whereuser='root';  
  30.  
  31. updatedbsetCreate_routine_priv='Y'whereuser='root';  
  32.  
  33. updatedbsetAlter_routine_priv='Y'whereuser='root';  
  34.  
  35. updatedbsetExecute_priv='Y'whereuser='root'; 

再把mysql.user表里root用戶的所有字段都置為'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.51cto.com/mysql/,一定會(huì)讓您滿意的哦!

【編輯推薦】

  1. 利用mysql的audit審計(jì)功能記錄用戶操作信息
  2. MySQL索引背后的數(shù)據(jù)結(jié)構(gòu)及算法之索引實(shí)現(xiàn)
  3. Facebook對(duì)MySQL依賴的后果將是“比死還糟
  4. 詳解Discuz_WIN7_Apache_MySQL_PHP平臺(tái)搭建
責(zé)任編輯:趙鵬 來(lái)源: 中國(guó)IT實(shí)驗(yàn)室
相關(guān)推薦

2011-03-07 16:42:05

MySQL數(shù)據(jù)庫(kù)安全

2010-05-27 18:24:09

MySQL數(shù)據(jù)庫(kù)密碼

2011-03-28 13:11:18

MySQL數(shù)據(jù)庫(kù)安全

2010-05-28 11:22:07

2009-11-18 16:10:00

2011-03-03 18:09:14

2018-03-26 12:58:52

數(shù)據(jù)庫(kù)OracleMySQL

2010-06-04 19:06:47

連接MySQL數(shù)據(jù)庫(kù)

2011-03-24 15:41:42

數(shù)據(jù)庫(kù)

2011-01-21 09:43:10

安恒數(shù)據(jù)庫(kù)安全安全審計(jì)

2017-12-27 13:07:52

數(shù)據(jù)庫(kù)MySQL主從復(fù)制

2011-08-03 14:02:02

數(shù)據(jù)庫(kù)連接ACCESS

2010-03-03 15:16:17

2023-09-21 23:08:36

MySQL數(shù)據(jù)庫(kù)死鎖

2010-05-13 10:27:24

MySQL數(shù)據(jù)庫(kù)

2009-03-31 11:57:52

2024-02-06 07:56:20

數(shù)據(jù)庫(kù)分布式數(shù)據(jù)庫(kù)架構(gòu)產(chǎn)品

2010-09-15 09:50:55

2011-01-21 10:10:27

2011-07-12 16:42:41

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)