1, install MariaDB
Installation Commands
yum -y install mariadb mariadb-server
Installation MariaDB, first start MariaDB, two commands are available
systemctl start mariadb
Set boot
systemctl enable mariadb
Next related simple configuration of MariaDB
mysql_secure_installation
First, set a password, you will be prompted to enter the password
Enter current password for root (enter for none): <- Enter the first time directly run
set password
Set root password [Y / n] <- whether to set the root password, enter y and press Enter, or just press Enter?
New password: <- set the root password
Re-new new the Enter password: <- Re-enter your settings password
Other configurations
? The Remove the Users Anonymous [the Y-/ the n-] <- whether to remove the anonymous user, enter
? Disallow root the Login remotely [the Y-/ the n-] <- prohibit root remote login, enter,
Database and Access to test the Remove IT [the Y-/ the n-]? <- whether to delete the test database, enter
? Reload privilege tables now [Y / n] <- whether to re-load authority table, enter
MariaDB initialization is complete, the next test Login
mysql -uroot -p password
carry out.
2, configure MariaDB character set
File /etc/my.cnf
we /etc/my.cnf
Added at [mysqld] tab
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
File /etc/my.cnf.d/client.cnf
we /etc/my.cnf.d/client.cnf
Add [client] in
default-character-set=utf8
File /etc/my.cnf.d/mysql-clients.cnf
we /etc/my.cnf.d/mysql-clients.cnf
Add [MySQL] in
default-character-set=utf8
All configuration is complete, restart mariadb
systemctl restart mariadb
After entering MariaDB view the character set
mysql> show variables like "%character%";show variables like "%collation%";
shown as
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
Character set configuration is complete.