MySQL8 0登陸 檢視 修改臨時密碼

2021-10-08 04:56:51 字數 1460 閱讀 7422

執行以下**:

mysql -uroot
執行結果如下:

error 1045 (28000): access denied for user 'root'@'localhost'

(using password: no)

錯誤的原因是秘密錯誤。初次啟動mysql時系統自動生成了臨時秘密,找到臨時密碼就可以正常登陸

cd /var/log
more mysqld.log
返回結果如下:

2020-07-16t17:07:59.769774z 0 [system] [my-013169] [server] /usr/sbin/mysqld (my

sqld 8.0.21) initializing of server in progress as process 9857

2020-07-16t17:07:59.776926z 1 [system] [my-013576] [innodb] innodb initializatio

n has started.

2020-07-16t17:08:00.567970z 1 [system] [my-013577] [innodb] innodb initializatio

n has ended.

2020-07-16t17:08:02.500261z 6 [note] [my-010454] [server] a temporary password i

s generated for root@localhost:ybitkorhk3--more--(21%)

獲得臨時秘密為:ybitkorhk3返回結果如下:

enter password: 

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 8

server version: 8.0.21

oracle is a registered trademark of oracle corporation and/or its

affiliates. other names may be trademarks of their respective

owners.

type 'help;' or '\h' for help. type '\c' to clear the current input statement.

在enter password:後面輸入臨時秘密即可登陸。

登陸mysql root使用者之後,使用執行以下命令以修改初始密碼:

alter  user 'root'@'localhost' identified by "mima@123"

;

MySQL8 0登陸問題

一 忽略密碼 mysql出現error1698 28000 access denied for user root localhost錯誤解決方法 在ubuntu的terminal 也即終端 上輸入sudo vim etc mysql mysql.conf.d mysqld.cnf,進入到這個配置檔...

MySQL8 0修改臨時密碼

解決mysql8.0報錯 unknown system variable validate password policy 一 問題描述 1 在安裝mysql8.0時,修改臨時密碼,因密碼過於簡單 如 123456 不符合mysql密碼規範,會觸發乙個報錯資訊 error 1819 hy000 yo...

mysql8 0修改登入

在mysql8.0當中的密碼認證外掛程式以經由mysql native password改為caching sha2 password 修改密碼的方式也發生了改變,控制台修改密碼方法如下 use mysql alter user root localhost identified by 新密碼 修改...