溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

忘記mysql數(shù)據(jù)庫(kù)密碼怎么辦?

發(fā)布時(shí)間:2020-07-24 15:51:12 來(lái)源:網(wǎng)絡(luò) 閱讀:454 作者:chengong1013 欄目:數(shù)據(jù)庫(kù)

一、破解mysql數(shù)據(jù)庫(kù)密碼步驟

1、修改mysql配置文件/etc/my.cnf 

[mysqld]
port        = 3306
socket      = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 2
datadir = /mydata/data
skip-grant-tables  #加入此項(xiàng)


2、重新啟動(dòng)mysqld 

# /etc/init.d/mysqld restart 
Stopping MySQL: [ OK ] 
Starting MySQL: [ OK ]


3.登錄并修改MySQL的root密碼 

# /usr/bin/mysql 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 3 to server version: 3.23.56 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 
mysql> 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> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ; 
Query OK, 0 rows affected (0.00 sec) 
Rows matched: 2 Changed: 0 Warnings: 0 
mysql> flush privileges ; 
Query OK, 0 rows affected (0.01 sec) 
mysql> quit 
Bye


5.將MySQL的登錄設(shè)置修改回來(lái) 

# vi /etc/my.cnf 
將剛才在[mysqld]的段中加上的skip-grant-tables刪除 
保存并且退出vi。


6.重新啟動(dòng)mysqld 

# /etc/init.d/mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ]


圖示:


修改如下:

忘記mysql數(shù)據(jù)庫(kù)密碼怎么辦?


重設(shè)密碼:

忘記mysql數(shù)據(jù)庫(kù)密碼怎么辦?






向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI