centos 7.0 用yum 安裝mysql 親測可用18年11月20日
阿新 • • 發佈:2018-11-27
用最少的命令完成mysql的建立
1安裝
yum -y install mariadb mariadb-server
2啟動
systemctl start mariadb
3開機自動啟動
systemctl enable mariadb
接下來進行MariaDB的相關簡單配置
mysql_secure_installation
首先是設定密碼,會提示先輸入密碼
Enter current password for root (enter for none):<–初次執行直接回車
設定密碼
Set root password? [Y/n] <– 是否設定root使用者密碼,輸入y並回車或直接回車
New password: <– 設定root使用者的密碼
Re-enter new password: <– 再輸入一次你設定的密碼
其他配置
Remove anonymous users? [Y/n] <– 是否刪除匿名使用者,回車
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 password 為你設定的密碼
最後一步 讓外部連線訪問 如:navcat
password 改成你設定的密碼即可
grant all privileges on *.* to [email protected]'%' identified by "password";