變更MySQL 8的root使用者密碼 === **一、找一台Ubuntu的電腦啟動一個docker的mysql服務** ```shell= docker run --name some-mysql1 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.29` ``` ![](https://i.imgur.com/Sp3qTVg.png) **二、進入這台`mysql`環境** ```shell= docker exec -it 67 bash ``` ![](https://i.imgur.com/5w6Hy50.png) **二、進入`mysql`環境介面** ```shell= mysql -uroot -p ``` ![](https://i.imgur.com/919AWC5.png) **四、更改mysql的root密碼** ```mysql= ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'NewPassword'; exit; ``` ![](https://i.imgur.com/PZXlWnT.png) **五、重新登入成功** ```shell= mysql -uroot -pNewPassword ``` ![](https://i.imgur.com/h4kgdyl.png)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up