Linux (Debian) 安裝MySQL 后如何獲取登錄密碼


樹莓派安裝MySQL后獲取登錄密碼

樹莓派基於Debian系統。

成功安裝MySQL后

su root
vim /etc/mysql/debian.cnf

其中 user 和 password 就是你用於登錄mysql的默認賬戶和密碼。

mysql -udebian-sys-maint -p
//鍵入passwd

就可以成功進入MySQL服務界面,更新默認賬戶密碼設置。

show databases; // 1.展示所有數據庫
use mysql; //2.選擇mysql數據庫
// 3.更新root密碼(5.7 之前的mysql)
update mysql.user set password=password('123456') where user='newuser' and host='localhost';
//3.更新root密碼(5.7 之后的mysql) 這兩個命令可以都嘗試下
update mysql.user set authentication_string=password('123456') where user='newuser' and host='localhost';
//4.權限刷新
flush privileges;

之后就可以用我們最熟悉的mysql-uroot -p來登錄了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM