【轉(zhuǎn)載】https://www.cnblogs.com/Cookies-Tang/p/10871556.html
前言
MariaDB是由原本開發(fā)MySQL的一些原始開發(fā)者領(lǐng)導(dǎo)蔽豺,他們擔心Oracle收購MySQL后會有一些隱患坛猪。MariaDB與MySQL保持這高度兼容性催什,并使用了一個新的存儲引擎Aria畅铭。
安裝MriaDB
sudo apt-get install mariadb-server
靜靜的等待安裝完成即可,中間會詢問是否繼續(xù),輸入Y繼續(xù)即可。安裝完成后就可以通過一下命令連接到MariaDB
sudo mysql
出現(xiàn)如下訊息表示已成功連接到MariaDB了
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type'help;'or'\h'forhelp. Type'\c'to clear the current input statement. MariaDB [(none)]>
配置密碼訪問
默認情況下MariaDB安裝好后都沒有配置訪問用戶的密碼,因此如果需要遠程連接時會無法連接按摘。因此需要先對root用戶設(shè)置密碼。首先透過上一步中的命令連接至MariaDB纫谅,輸入如下語句進行密碼的修改
usemysql;
UPDATEuserSETpassword=password('password')WHEREuser='root';
UPDATEuserSETplugin='mysql_native_password'WHEREuser='root';
flushprivileges;?
exit
以上執(zhí)行完成后院峡,重啟服務(wù)
sudo systemctl restart mariadb
重啟完成后,試用密碼進行mariadb登錄系宜,驗證是否修改成功
mysql -u root -p
輸入上面設(shè)置的密碼就可以看到第一步安裝完成登錄時一樣的畫面了照激。