1、yum安裝 # yum install mariadb-server
2、啓動服務
# systemctl start mariadb # 開啓服務
# systemctl enable mariadb # 設置爲開機自啓動服務
3、配置數據庫 Enter current password for root (enter for none): # 輸入數據庫超級管理員root的密碼(注意不是系統root的密碼),第一次進入還沒有設置密碼則直接回車 Set root password? [Y/n] # 設置密碼,y New password: # 新密碼 Re-enter new password: # 再次輸入密碼 Remove anonymous users? [Y/n] # 移除匿名用戶, y Disallow root login remotely? [Y/n] # 拒絕root遠程登錄,n,不管y/n,都會拒絕root遠程登錄 Remove test database and access to it? [Y/n] # 刪除test數據庫,y:刪除。n:不刪除,數據庫中會有一個test數據庫,一般不需要 Reload privilege tables now? [Y/n] # 重新加載權限表,y。或者重啓服務也許
4、驗證是否配置成功
# mysql -u root -p