安裝MariaDB:mysql
yum -y install mariadb mariadb-server
啓動MariaDBsql
systemctl start mariadb
開機啓動數據庫
systemctl enable mariadb
MariaDB的相關簡單配置ide
mysql_secure_installation
首先是設置密碼,會提示先輸入密碼測試
Enter current password for root (enter for none):<–初次運行直接回車code
設置密碼server
Set root password? [Y/n] <– 是否設置root用戶密碼,輸入y並回車或直接回車
New password: <– 設置root用戶的密碼
Re-enter new password: <– 再輸入一次你設置的密碼rem
其餘配置it
Remove anonymous users? [Y/n] <– 是否刪除匿名用戶,回車io
Disallow root login remotely? [Y/n] <–是否禁止root遠程登陸,回車,
Remove test database and access to it? [Y/n] <– 是否刪除test數據庫,回車
Reload privilege tables now? [Y/n] <– 是否從新加載權限表,回車
初始化MariaDB完成,接下來測試登陸
mysql -uroot -ppassword
設置遠程訪問mysql
mysql> grant all privileges on *.* to 'root'@'%' identified by 'admin'; mysql> flush privileges;