CentOS7 install MySQL8

MariaDB is installed by default in CentOS. This is a branch of MySQL, but for needs, MySQL must be installed in the system, and MariaDB can be overwritten directly after installation.

1 Download and install MySQL official Yum Repository

[ root@localhost ~]# wget -i -c  https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

Use the above command to directly download the Yum Repository for installation, about 25KB, and then you can directly install it with Yum.

[ root@localhost ~]# yum -y install mysql80-community-release-el7-1.noarch.rpm

After that, install the MySQL server.

[ root@localhost ~]# yum -y install mysql-community-server

This step may take some time, and the previous mariadb will be overwritten after the installation is complete.

At this point MySQL is installed, and then some settings for MySQL.

2 MySQL database settings###

First start MySQL

[ root@localhost ~]# systemctl start  mysqld.service

Check the running status of MySQL, as shown in the figure:

[ root@localhost ~]# systemctl status mysqld.service

At this point MySQL has started to run normally, but if you want to enter MySQL, you must first find out the password of the root user at this time. You can find the password in the log file by using the following command:

[ root@localhost ~]# grep "password"/var/log/mysqld.log

Enter the database with the following command:

[ root@localhost ~]# mysql -uroot -p

Enter the initial password, you can't do anything at this time, because MySQL must change the password to operate the database by default:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

There is a problem here. If the new password is set too simple, an error will be reported:

The reason is because MySQL has a password setting specification, which is specifically related to the value of validate_password_policy:

The complete initial password rules of MySQL can be viewed with the following command:

mysql> SHOW VARIABLES LIKE 'validate_password%';+--------------------------------------+-------+| Variable_name                        | Value |+--------------------------------------+-------+| validate_password_check_user_name    | OFF   || validate_password_dictionary_file    ||| validate_password_length             |4|| validate_password_mixed_case_count   |1|| validate_password_number_count       |1|| validate_password_policy             | LOW   || validate_password_special_char_count |1|+--------------------------------------+-------+7 rows inset(0.01 sec)

The length of the password is determined by validate_password_length, and the calculation formula of validate_password_length is:

validate_password_length = validate_password_number_count + validate_password_special_char_count +(2* validate_password_mixed_case_count)

Mine has been modified. Initially, the first value is ON, and validate_password_length is 8. It can be modified by the following command:

mysql>set global validate_password_policy=0;
mysql>set global validate_password_length=1;

After setting, it is the values I found above. At this time, the password can be set very simple, such as 1234. The password setting of this database is complete.

But there is still a problem at this time, because Yum Repository is installed, and every yum operation will be automatically updated in the future, you need to uninstall this:

[ root@localhost ~]# yum -y remove mysql57-community-release-el7-10.noarch

Only then was it really finished.

Recommended Posts

CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
CentOS 7.2 Yum install MySQL 5.6
Centos manually install mysql8
Install mysql under Centos 7
Centos7 install Mysql database
Install mysql5.1 under CentOS6.5
1.5 Install Centos7
Install mysql online on centos
centos install mysql through yum
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
Centos6 install mysql 5.7.x series
CentOS8 install MySQL8 (pro test)
Centos6 install Python2.7.13
CentOS7 yum install and start mysql
Centos7.3 install nginx
CentOS Yum compile and install MySQL 5.6
CentOS install Redmine
Centos7 install Python 3.6.
Centos7 install protobuf
CentOS 7 install Docker
CentOS 7 install Nginx, PHP, MySQL packages
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
Install MySQL on Linux CentOS7 (Windows)
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos yum install mysql5.6 or above
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
centos7 .*tar package to install MySQL5.7