溫馨提示×

溫馨提示×

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

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

centos7中Mysql修改密碼的幾種方法

發(fā)布時間:2020-09-30 17:05:30 來源:網(wǎng)絡(luò) 閱讀:1803 作者:wx5d4557ee5e827 欄目:MySQL數(shù)據(jù)庫

修改密碼
root修改自己密碼
方法一:

mysqladmin -uroot -p'123' password 'new_password' //123為舊密碼

方法二:
在Mysql中

    update mysql.user set authentication_string=password('Qianfeng123!') where user='root' and host='localhost';

方法三:
給哪個用戶設(shè)置密碼,你要在哪個用戶下執(zhí)行

set password=password("new_password'')

上面方法將會在后面的版本remove,使用下面方法

SET PASSWORD='new_password';  直接設(shè)置密碼

root修改其他用戶密碼
方法一:

mysql> SET PASSWORD FOR user3@'localhost'=password('new_password');

上面的方法會在將來remove,使用下面的方法:

mysql> SET PASSWORD FOR user3@'localhost'='new_password';

方法二:

UPDATE mysql.user SET authentication_string=password('new_password')
    WHERE user='user3' AND host='localhost';

普通用戶修改自己密碼

mysql> SET password=password('new_password');
mysql> select * from mysql.user\G
mysql> alter user 'wing'@'localhost' identified by 'Qianfeng123!@';
向AI問一下細節(jié)

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

AI