1.安裝MariaDB數據庫mysql
yum -y install mariadb mariadb-serversql
2.啓動MariaDB數據庫數據庫
systemctl start mariadbvim
3.設置開機啓動測試
systemctl enable mariadbspa
4.MariaDB的建立過程3d
mysql_secure_installationrest
Set root password? [Y/n] yes #是否設置密碼
New password: #輸入要設置的密碼
Re-enter new password: #確認密碼
Password updated successfully!
Reloading privilege tables..
... Success! #提示建立成功code
Remove anonymous users? [Y/n] #是否刪除匿名用戶,回車server
Disallow root login remotely? [Y/n] #是否禁止root遠程登陸,回車
Remove test database and access to it? [Y/n] #是否刪除test數據庫,回車
Reload privilege tables now? [Y/n] #是否從新加載權限表,回車
5.初始化完成後測試登陸
mysql -uroot -p'設置的密碼'
6.配置MariaDB的字符集
vim /etc/my.cnf
在[mysqld]標籤下添加
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
文件/etc/my.cnf.d/client.cnf
vi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
文件/etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
所有配置完成,重啓mariadb
systemctl restart mariadb
7.進入MariaDB查看字符集
mysql -uroot -p'設置的密碼'
show variables like "%character%";show variables like "%collation%";