Yesterday is a history, tomorrow is a mystery, but today is a gift.html
mysql 在樹莓派 raspberry pi 上的安裝和在 Linux 上的差很少,由於網上的教程只是記述了一部分且遇到了狀況,就整理下來mysql
sudo apt-get update
sudo apt-get install mysql-server
接下來就是安裝過程了,原本覺得中間會提示輸入密碼,結果一口氣就安裝完了,想到該怎麼登錄啊linux
sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
注:遇到陌生的 MariaDB,百科了發現是 mysql 的一個分支,徹底繼承 mysql 的用法,因此也不擔憂了,不過,這個應該是看我的狀況的sql
# 數據庫中使用
# 鏈接數據庫
use mysql;
# 修改密碼爲123456,本身定
UPDATE user SET password=PASSWORD('123456') WHERE user='root';
# 刷新
flush privileges;
# 退出
exit;
sudo /etc/init.d/mysql status/start/stop/restart
安裝以後須要修改密碼,否則密碼爲空shell