亚洲国产精品人久久,亚洲va国产日韩欧美精品色婷婷,久久久久88色偷偷,免费人成黄页在线观看国际

17站長網(wǎng)

17站長網(wǎng) 首頁 數(shù)據(jù)庫 Mysql 查看內(nèi)容

MySQL的root密碼忘記或丟失的解決方法之一

2023-3-16 14:34| 查看: 1518 |來源: 互聯(lián)網(wǎng)

-bash-4.2$ service mysql statusSUCCESS! MySQL running (2670)-bash-4.2$ mysql -u root -pEnter password:ERROR 1045 (28000): Access denied for user &#3 ...

-bash-4.2$ service mysql status

SUCCESS! MySQL running (2670)

-bash-4.2$ mysql -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

以下是密碼忘記的解決方法:

修改MySQL的參數(shù)設(shè)置:

# vi /etc/my.cnf

在[mysqld]的段最后一行加上一句:skip-grant-tables

例如:

[mysqld]

........................

log-bin=mysql-bin

innodb_data_file_path = ibdata1:12M;ibdata2:100M;ibdata3:300M:autoextend

innodb_file_per_table=on

max_connections=500

skip-grant-tables    --新增加行

保存并且退出vi.

 

重啟MySQL服務(wù):

[root@chenfeng subsys]# service mysql restart

Shutting down MySQL. SUCCESS!

Starting MySQL. SUCCESS!

 

-bash-4.2$ mysql    --不用輸密碼直接登錄

Welcome to the MariaDB monitor.  Commands end with ; or /g.

Your MySQL connection id is 2

Server version: 5.6.15-log Source distribution

  

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

  

Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.

  

MySQL [(none)]> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| chenfeng           |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

  

MySQL [(none)]> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

  

Database changed

MySQL [mysql]>  UPDATE user SET Password = password ('12345678') WHERE User ='root';   --修改為新密碼12345678

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4  Changed: 4  Warnings: 0

 

MySQL [mysql]>

MySQL [mysql]> flush privileges;   --刷新一下權(quán)限表

Query OK, 0 rows affected (0.00 sec)

 

MySQL [mysql]> quit

Bye

 

將MySQL的參數(shù)設(shè)置修改回來:

# vi /etc/my.cnf

將剛才在[mysqld]的段中最后一行加上的skip-grant-tables刪除,然后保存退出。

 

重啟MySQL服務(wù):

[root@chenfeng subsys]# service mysql restart

Shutting down MySQL. SUCCESS!

Starting MySQL. SUCCESS!

  

重新用新密碼登錄:

-bash-4.2$ mysql -u root -p12345678      --12345678為新密碼

Welcome to the MariaDB monitor.  Commands end with ; or /g.

Your MySQL connection id is 7

Server version: 5.6.15-log Source distribution

  

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

  

Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.

  

MySQL [(none)]> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

  

Database changed

MySQL [mysql]> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| chenfeng           |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

MySQL [mysql]> 

本文最后更新于 2023-3-16 14:34,某些文章具有時效性,若有錯誤或已失效,請?jiān)诰W(wǎng)站留言或聯(lián)系站長:17tui@17tui.com
·END·
站長網(wǎng)微信號:w17tui,關(guān)注站長、創(chuàng)業(yè)、關(guān)注互聯(lián)網(wǎng)人 - 互聯(lián)網(wǎng)創(chuàng)業(yè)者營銷服務(wù)中心

免責(zé)聲明:本站部分文章和圖片均來自用戶投稿和網(wǎng)絡(luò)收集,旨在傳播知識,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請勿用于商業(yè)用途,如果損害了您的權(quán)利,請聯(lián)系我們及時修正或刪除。謝謝!

17站長網(wǎng)微信二維碼

始終以前瞻性的眼光聚焦站長、創(chuàng)業(yè)、互聯(lián)網(wǎng)等領(lǐng)域,為您提供最新最全的互聯(lián)網(wǎng)資訊,幫助站長轉(zhuǎn)型升級,為互聯(lián)網(wǎng)創(chuàng)業(yè)者提供更加優(yōu)質(zhì)的創(chuàng)業(yè)信息和品牌營銷服務(wù),與站長一起進(jìn)步!讓互聯(lián)網(wǎng)創(chuàng)業(yè)者不再孤獨(dú)!

掃一掃,關(guān)注站長網(wǎng)微信

大家都在看

    熱門排行

      最近更新

        返回頂部