switch user
1. Switch to the root user for operation
Install the service client
1. Install mariadb service
yum install -y mariadb-server
2. Install mariadb command line client
yum install -y mariadb
3. Install mariadb C library
yum install -y mariadb-libs
4. Install mariadb development kit
yum install -y mariadb-devel
Modify file configuration
1. Change the /etc/my.cnf.d/client.cnf file
[client] and add a line of configuration default-character-set=utf8
2. Change the /etc/my.cnf.d/mysql-clients.cnf file
[mysql] and add a line of configuration default-character-set=utf8
3. Change /etc/my.cnf.d/server.cnf configuration
[mysqld] add configuration
collation-server = utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
sql-mode = TRADITIONAL
start test
1. Restart the service
systemctl restart mariadb
2. Set the service to start automatically
systemctl enable mariadb
3. View service status
systemctl status mariadb
use
1. Use the command line client to try to connect, and there is no password by default
mysql -uroot
2. View the mariadb version number
select version();
3. Check the character set configuration
show variables like '%char%';
set password
1. Exit the mysql server and return to the shell
mysql_secure_installation
You will be prompted before entering the password, just enter Y, and then you will enter the password twice. After the input, you will be prompted to enter all Y
2. Use the command line client to try to connect (with password)
mysql -uroot -p
The installation is complete