安裝好MariaDB以后芽腾,首先設(shè)置開機(jī)自啟往弓,開啟守護(hù)進(jìn)程:
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
如果數(shù)據(jù)庫運(yùn)行在生產(chǎn)環(huán)境疏唾,建議使用安全設(shè)置:
mysql_secure_installation
這樣會讓你決定是否修改root密碼、禁止遠(yuǎn)程登錄函似、刪除測試數(shù)據(jù)庫槐脏、移除匿名賬戶、重載權(quán)限配置等操作
修改配置文件:
vim /etc/my.cnf
在 [mysqld] 標(biāo)簽下添加
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
退出保存
vi /etc/my.cnf.d/client.cnf
在 [client] 中添加
default-character-set=utf8
退出保存
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
修改完畢以后重啟服務(wù):
systemctl restart mariadb
簡單連接:
mysql -u root -p
輸入密碼撇寞,開啟新世界大門