Mysql 7.x Mysql 7.x Mysql 7.x Mysql 7.x Mysql 7.x Mysql 7.x Mysql 7.x

Install using YUM

Since CentOS 7.0 was released, Mariadb has been used in yum to replace MySQL installation. Even if you type yum install -y mysql, the Mariadb installation is displayed. Using source code to compile and install is too cumbersome. Therefore, if you want to install MySQL with yum, you need to download the official yum source. 7 https://dev.mysql.com/downloads/repo/yum/ Red Hat Enterprise Linux/Oracle Linux 7 (Architecture Independent). RPM Package, click Download. On the next page, click No Thanks, just start my Download. You can download it to the YUM source. 1) Install the MySQL YUM repository [root@hejianhui ~]# yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm2) Install MySQL 5.7 [root@hejianhui ~]# yum install -y mysql-community-server3) Start MySQL server and automatic start of MySQL [root@hejianhui ~]# systemctl start mysqld.service
[root@hejianhui ~]# systemctl enable mysqld.serviceMySQL 5.7 does not allow users to log in with an empty password after the first installation. To enhance security, the system randomly generates a password for the administrator to log in for the first time. This password is recorded in /var/logTo check the password, run the following command in the /mysqld.log file: [root@hejianhui ~]# cat /var/log/mysqld.log|grep 'A temporary password'
2018-01-20T02:32:20.210903Z 1 [Note] A temporary password is generated forroot@localhost: DOqInortw9/< The part of DOqInortw9/< after the colon in the last line is the initial password. Use this password to log in to MySQL: [root@hejianhui ~]# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.21
 
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help; ' or '\h' for help. Type '\c'to clear the current input statement. After logging in to the server using the random password, you must change the password immediately. Otherwise, the following error message is displayed: mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. Mysql > alter table mysql> alter table mysql> alter table mysql> alter table 123456set password=password("123456");
或者
mysql> alter user 'root'@'localhost' identified by '123456'; Mysql > update privileges; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = if above in executionset password=password("123456"); ERROR 1819 (HY000): Your password does not satisfy the current policy requirements The value of validate_password_policy can be 0, 1, or 2:0 or LOW Length 1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters 2 or STRONG Length; numeric, lowercase/uppercase, and special characters; The default value of dictionary is 1, which is of length and must contain numbers, lowercase or uppercase letters, and special characters. Therefore, the password must contain digits, lowercase or uppercase letters, and special characters. Sometimes, just for my own testing purposes, I don't want to make the password complex, for example, I want to set root's password to 123456. Two global parameters must be modified: mysql>set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
 
mysql> setglobal validate_password_length=1; Query OK, 0 rows affected (0.00 SEC) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = note: Mysql > select authentication_string from mysql5.7; Therefore, run the following command to change the password: mysql> update mysql.userset authentication_string=password('123456') where user='root'; Query OK, 1 row affected, 1 warning (0.00 SEC) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush PRIVILEGES; Query OK, 0 rows affected (0.00 SEC) mysql> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = check mysql version mysql >  select version(); + -- -- -- -- -- -- -- -- -- -- -- + | version () | + -- -- -- -- -- -- -- -- -- -- -- + | 5.7.21 | + -- -- -- -- -- -- -- -- -- -- - + 1 rowin set(0.00 SEC) mysql > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Mysql > show variables like mysql5.7 mysql> show variables like"%character%"; show variables like"%collation%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set(0.00 SEC) + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | Variable_name Value | | +----------------------+-------------------+ | collation_connection | utf8_general_ci | | collation_database | latin1_swedish_ci | | collation_server | latin1_swedish_ci | +----------------------+-------------------+ 3 rowsin set(0.01 SEC) Adjustment operation: [root@hejianhui ~]# cat /etc/my.cnf. [mysqld] ...... // default-character-set=utf8, [client] default-character-set=utf8 [root@hejianhui~]# systemctl restart mysqld.service
[root@hejianhui~]# mysql -p. mysql> show variables like"%character%"; show variables like"%collation%";
+--------------------------+----------------------------+
| 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.01 SEC) + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | Variable_name Value | | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | +----------------------+-----------------+ 3 rowsin set(0.00 SEC) mysql >Copy the code

2. Install using RPM package

1) Uninstall mysql and Mariadb -lib [root@hejianhui ~]# /bin/rpm -e $(/bin/rpm -qa | grep mysql|xargs) --nodeps
[root@hejianhui ~]# /bin/rpm -e $(/bin/rpm -qa | grep mariadb|xargs) --nodeps2) download mysql5.7.21 RPM installation package download address: http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/ [root @ hejianhui ~]Wget # http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
[root@hejianhui ~]# tar - VXF mysql - 5.7.21-1. El7. X86_64. RPM - bundle. The tar
[root@hejianhui ~]# ll1160052-rw -------. 1 root root 2090 Jan 24 02:35 anaconda -ks.cfg-rw-r --r-- 1 root root 593940480 Dec 28 21:03 Mysql -5.7.21-1.el7.x86_64. RPM -bundle.tar -rw-r--r-- 1 7155 31415 25107316 12月 28 20:53 RPM -rw-r--r-- 1 7155 31415 278844 12月 28 20:53 RPM -rw-r--r-- 1 7155 31415 3779988 12月 28 20:53 RPM -rw-r--r-- 1 7155 31415 46256768 12月 28 20:53 RPM -rw-r--r-- 1 7155 31415 24078148 12月 28 20:53 RPM -rw-r--r--. 1 7155 31415 128571868 12月 28 20:53 RPM -rw-r--r--. 1 7155 31415 2238596 12月 28 20:53 RPM -rw-r--r-- 1 7155 31415 2115904 12月 28 20:54 RPM -rw-r--r-- 1 7155 31415 55662616 12月 28 20:54 Mysql -community-minimal debuginfo-5.7.21-1.el7.x86_64. RPM -rw-r--r-- 1 7155 31415 171890056 12月 28 20:54 RPM -rw-r--r-- 1 7155 31415 15289580 12月 28 20:54 Mysql-community-server-minimal -5.7.21-1.el7.x86_64. RPM -rw-r--r-- 1 7155 31415 118654584 12月 28 20:54 Mysql -community-test-5.7.21-1.el7.x86_64. RPM mysql-community-test-5.7.21-1.el7.x86_64.RPM --force # RPM -ivh mysql-community-common-5.7.21-1.el7.x86_64
[root@hejianhui ~]# RPM -ivh mysql-community-libs-5.7.21-1.el7.x86_64. RPM --force # RPM -ivh mysql-community-libs-5.7.21-1.el7.x86_64
[root@hejianhui ~]RPM --force # RPM -ivh mysql-community-client-5.7.21-1.el7.x86_64
[root@hejianhui ~]RPM --force # RPM -ivh mysql-community-server-5.7.21-1.el7.x86_64= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = [root@hejianhui ~] : [root@hejianhui ~] : [root@hejianhui ~] : [root@hejianhui ~] : [root@hejianhui ~] : [root@hejianhui ~]RPM --force # RPM -ivh mysql-community-server-5.7.21-1.el7.x86_64Warning: mysql-community-server-5.7.21-1.el7.x86_64. RPM: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: Libaio.so.1()(64bit) is needed by mysql-community-server-5.7.21-1.el7.x86_64 libaio.so.1(libaio_0.1)(64bit) is needed by Mysql -community-server-5.7.21-1.el7.x86_64 libaio.so.1(libaio_0.4)(64bit) is needed by Ql-community-server-5.7.21-1.el7.x86_64 Nettools is needed by ql-community-server-5.7.21-1.el7.x86_64 Install libaio-0.3.107-10.el6.x86_64. RPM [root@hejianhui ~]Wget # http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
[root@hejianhui ~]# RPM -ivh libaio-0.3.107-10.el6.x86_64. RPM --forceInstall Net-Tools. [root@hejianhui ~]# yum install net-tools = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = RPM is used to install mysql. The installation path is as follows: Database directory /var/lib/mysql.configuration file /usr/share/mysql(mysql.server command and configuration file) /etc/my. CNF command /usr/bin(mysqladmin mysqldump command and other commands) Mysql > initialize mysql database /etc/rc.d/init.d/ To initialize, run the following command: [root@hejianhui ~]# mysql_install_db --datadir=/var/lib/mysql // Datadir must be specified, the ~/. Mysql_secret password file will be generated
[root@hejianhui ~]# mysqld --initialize --user= mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld -- mysqld If you are running as mysql, you can remove the --user option.4) Change the owning user and owning group of mysql database directory and start mysql database [root@hejianhui ~]# chown mysql:mysql /var/lib/mysql -R
[root@hejianhui ~]# systemctl start mysqld.serviceMysql > initialize; mysql > initialize; mysql > initialize; mysql > initialize; It will generate a password for root and mark it as expired, and you'll need to set a new password once you're logged in. Using --initialize-insecure will not generate a password for root if you're not insecure mode. Initialize generates a root password in thelogAt the end of the file is the following")1r3gi,hjgQa"Is the generated root password [root@hejianhui ~]# cat /var/log/mysqld.log. 07T04.41:58.420558z 1 [Note] A temporary password is generatedfor root@localhost: )1r3gi,hjgQa 
 
[root@hejianhui ~]# mysql -uroot -p')1r3gi,hjgQa'
mysql> set password=password('123456');
mysql> flush privileges
Copy the code

Three, compilation mode installation

1) Uninstall mysql and Mariadb -lib [root@hejianhui ~]# /bin/rpm -e $(/bin/rpm -qa | grep mysql|xargs) --nodeps
[root@hejianhui ~]# /bin/rpm -e $(/bin/rpm -qa | grep mariadb|xargs) --nodeps/usr/bin/yum -y install make gcc-C ++ cmake bison-devel ncurses-devel [root@hejianhui ~]#3) Install boost [root@hejianhui ~]# mkdir -p /usr/local/boost
[root@hejianhui ~]# cd /usr/local/boost
[root@hejianhui boost]Wget # http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
[root@hejianhui boost]# tar -zvxf boost_1_59_0.tar.gzMysql5.7.21 [root@hejianhui ~]# /usr/sbin/groupadd mysql
[root@hejianhui ~]# /usr/sbin/useradd -g mysql mysql -M -s /sbin/nologin
[root@hejianhui ~]# cd /usr/local/src
[root@hejianhui src]C # wget - http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/mysql-5.7.21.tar.gz
[root@hejianhui src]# / bin/tar ZXVF mysql - 5.7.21. Tar. Gz
[root@hejianhui src]# CD mysql - 5.7.21 /[root @ hejianhui mysql - 5.7.21]# /usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/data/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/usr/local/ boost [root @ hejianhui mysql - 5.7.21]# make && make install/data/mysql [root@hejianhui mysql-5.7.21]# mkdir -p /data/mysql/data[root @ hejianhui mysql - 5.7.21]# /bin/chown -R mysql:mysql /data/mysql[root @ hejianhui mysql - 5.7.21]# /bin/chown -R mysql:mysql /data/mysql/data6) Execute the initial configuration script to create the database and table of the system [root@hejianhui mysql-5.7.21]# /data/mysql/bin/mysql_install_db --basedir=/data/mysql --datadir=/data/mysql/data --user=mysql7) Configure my.cnf [root@hejianhui mysql-5.7.21]# cat /data/mysql/my.cnf
[client]
port = 3306
socket = /data/mysql/var/mysql.sock
   
[mysqld]
port = 3306
socket = /data/mysql/var/mysql.sock
   
basedir = /data/mysql/
datadir = /data/mysql/data
pid-file = /data/mysql/data/mysql.pid
user = mysql
bind-address = 0.0.0.0 server-id =1 sync_binlog=1 log_bin = mysql-bin skip-name-resolve#skip-networking
back_log = 600
   
max_connections = 3000
max_connect_errors = 3000
##open_files_limit = 65535
table_open_cache = 512
max_allowed_packet = 16M
binlog_cache_size = 16M
max_heap_table_size = 16M
tmp_table_size = 256M
   
read_buffer_size = 1024M
read_rnd_buffer_size = 1024M
sort_buffer_size = 1024M
join_buffer_size = 1024M
key_buffer_size = 8192M
   
thread_cache_size = 8
   
query_cache_size = 512M
query_cache_limit = 1024M
   
ft_min_word_len = 4
   
binlog_format = mixed
expire_logs_days = 30
   
log_error = /data/mysql/data/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/data/mysql-slow.log
   
performance_schema = 0
explicit_defaults_for_timestamp
   
##lower_case_table_names = 1
   
skip-external-locking
   
default_storage_engine = InnoDB
##default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 40960M
innodb_write_io_threads = 1000
innodb_read_io_threads = 1000
innodb_thread_concurrency = 8
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 4M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
   
bulk_insert_buffer_size = 8M
#myisam_sort_buffer_size = 8M
#myisam_max_sort_file_size = 1G
#myisam_repair_threads = 1interactive_timeout = 28800 wait_timeout = 28800 [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M read_buffer = 4M write_buffer = 4M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES port = 3306 8) Start mysql service [root@hejianhui mysql-5.7.21]# cd /data/mysql
[root@hejianhui mysql]# /bin/mkdir var
[root@hejianhui mysql]# /bin/chown -R mysql.mysql var
[root@hejianhui mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@hejianhui mysql]# /sbin/chkconfig mysql on
[root@hejianhui mysql]# service mysql start9) Setting environment variables [root@hejianhui mysql]# echo "export PATH=$PATH:/data/mysql/bin" >> /etc/profile
[root@hejianhui mysql]# source /etc/profile10) Set the mysql login password. The initial password is nextcloud@123 [root@hejianhui mysql].# /bin/mkdir -p /var/lib/mysql
[root@hejianhui mysql]# ln -s /data/mysql/var/mysql.sock /var/lib/mysql/mysql.sockMySQL 5.7 does not allow users to log in to the MySQL database with an empty password. In addition, the mysql. User table after mysql5.7 no longer contains the password field, and the password field has been changed to authentication_string. Therefore, run the following command to change the password: [root@hejianhui mysql]# vim /data/mysql/my.cnf. [mysqld] ...... Skip -grant-tables# service mysql restart
[root@hejianhui mysql]# mysql -p
mysql> update mysql.user set authentication_string=password('123456') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
   
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
   
mysql>
Copy the code

/data/mysql/my.cnf/skip-grant-tables /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf /data/mysql/my.cnf

Mysql_install_db: mysql_install_db: mysqld –initialize!

[root @ lamp - new mysql - 5.7.23]# /data/mysql/bin/mysql_install_db --basedir=/data/mysql --datadir=/data/mysql/data --user=mysql
2018-11-22 14:16:02 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-11-22 14:16:18 [WARNING] The bootstrap log isn't empty: 2018-11-22 14:16:18 [WARNING] 2018-11-22T06:16:02.633498z 0 [WARNING] -- Bootstrap is deprecated in the future. Please consider using 2018-11-22T06:16:02.645463z 0 [Warning] Changed limits: MAX_open_files: [Warning] Changed limits: table_open_cache: Requested 5000 2018-11-22T06:16:02.645476z 0 Mysql_install_db is deprecated and will be deprecated in the future. Mysql_install_db is deprecated and will be deprecated in the future. Please consider switching to mysqld --initialize, So the correct way to initialize is to use mysqld --initialize instead of mysql_install_db, mysql5.7 new feature!!!!! [root@lamp-new mysql]# /data/mysql/bin/mysqld --basedir=/data/mysql --datadir=/data/mysql/data --user=mysql --initialize 2018-11-22T06:25:33.481308z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-11-22T06:25:34.192747z 0 [Warning] InnoDB: New log Files created, LSN=45790 2018-11-22T06:25:34.473292z 0 [Warning] InnoDB: New log files created, LSN=45790 2018-11-22T06:25:34.473292z 0 Creating Foreign key Constraint System tables. 2018-11-22T06:25:34.664979z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6B50BA05-EE1F-11E8 -AFC3-005056880F83.2018-11-22T06:25:34.689381z 0 [Warning] Gtid table is not ready to be used. table 'mysql.gtid_executed2018-11-22T06:25:34.690649z 1 [Note] A temporary password is generated for root@localhost: Jr6wa4ezp3&m MySQL 5.7 generates A temporary password after initialization for root@localhost: Innodb_data_file_path = IBDATA1 :1G:autoextend if you want to initialize the tablespace, add -- innodb_datA_FILe_path = IBDATA1 :1G:autoextend.Copy the code

Yum install MariaDB

[root@hejianhui ~]# yum -y install mariadb mariadb-server
[root@hejianhui ~]# systemctl start mariadb
[root@hejianhui ~]# systemctl enable mariadbIf you set a password, you will be prompted to enter the password [root@hejianhui ~]# mysql_secure_installationThe first step is to set the password. You will be prompted to Enter the password Enter current passwordfor root (enter forNone):< - Enter the password Set root password? [Y/n] < - Whether to set a password for user root, type Y and press Enter or press Enter. New password: < - Set a password for user root. < -- Enter the password you set again and other Settings Remove anonymous users? [Y/n] < - Whether to delete anonymous users and press Enter Disallow root login Remotely? [Y/n] < - Press Remove to disable root remote logintestdatabase and access to it? [Y/n] < - Whether to deletetestReload privilege tables now? [Y/n] < - Whether to reload the permission table, press enter [root@hejianhui ~]# mysql -p123456Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.56-MariaDB MariaDB Server Copyright (C) 2000, 2017, Oracle, MariaDB Corporation Ab and Others.type'help; ' or '\h' for help. Type '\c' to clear the current input statement.
  
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set(0.01sec) MariaDB [(none)]> next set MariaDB character set: -> first set MariaDB character set /etc/my.cnf, add init_connect= under [mysqld] tag'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 -> [client] add default-character-set=utf8 -> add mysql-client.cnf to /etc/my.cnf.d/ mysql-client.cnf Mysql > select * from MariaDB where default character-set=utf8test-vm001 my.cnf.d]# systemctl restart mariadb
  
[root@hejianhui ~]# mysql -p123456Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 5.5.56-MariaDB MariaDB Server Copyright (C) 2000, 2017, Oracle, MariaDB Corporation Ab and Others.type'help; ' or '\h' for help. Type '\c' to clear the current input statement.
  
MariaDB [(none)]> show variables like "%character%"; show variables like"%collation%";
+--------------------------+----------------------------+
| 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 rowsin set(0.00 SEC) MariaDB [(none)]> create database Confluence default characterset utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
  
MariaDB [(none)]> grant all on confluence.* to 'confluence'@The '%' identified by 'confluencepasswd';
Query OK, 0 rows affected (0.00 sec)
  
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Copy the code