MySql 5.7 deployment (test Centos7.5 stable operation for more than a year) 1. Prepare the RPM packages

To dev.mysql.com/downloads/m…

Mysql – community – libs – 5.7.27-1. El7. X86_64. RPM

Mysql – community – common – 5.7.27-1. El7. X86_64. RPM

Mysql – community – libs – compat – 5.7.27-1. El7. X86_64. RPM

Mysql – community – the client – 5.7.27-1. El7. X86_64. RPM

Mysql – community – server – 5.7.27-1. El7. X86_64. RPM

Mysql – community – devel – 5.7.27-1. El7. X86_64. RPM

2. Install

– 1. Before installation must unload system itself to carry the mysql component, generally is mariadb, using the RPM command – qa | grep mariadb to see whether there is any, is uninstalled, or it will conflict with mysql5.7

-2. Save the RPM package to the /usr/local/page/ directory. The RPM package is named by page for storing RPM packages and other installation packages.

-3. Run the command to start

CD /usr/local/paga — Install the mysql program

The RPM – the ivh mysql – community – common – 5.7.27-1. El7. X86_64. RPM

RPM – the ivh mysql – community – libs – 5.7.27-1. El7. X86_64. RPM

The RPM – the ivh mysql – community – libs – compat – 5.7.27-1. El7. X86_64. RPM

The RPM – the ivh mysql – community – the client – 5.7.27-1. El7. X86_64. RPM

RPM – the ivh mysql – community – server – 5.7.27-1. El7. X86_64. RPM

The RPM – the ivh mysql – community – devel – 5.7.27-1. El7. X86_64. RPM

Systemctl start mysqld — start mysql

Mkdir -p /data/mysql/data — Creates the database configuration path directory

Systemctl stop mysqld — stop mysql

Vi /etc/my.cnf — modify Add the following content:


datadir=/data/mysql/data

socket=/data/mysql/data/mysql.sock

skip_host_cache

skip-name-resolve=1

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES,NO_AUTO_CREATE_USER

lower_case_table_names=1

validate_password_policy=0

validate_password_length=4

[client]

socket=/data/mysql/data/mysql.sock


cp -r /var/lib/mysql/* /data/mysql/data/

chown -R mysql:mysql /data/mysql/data/*

chown -R mysql:mysql /data/mysql/data

Systemctl start mysqld — start mysql

Grep “password” /var/log/mysqld.log ##

Mysql -uroot -p temporary password ##

alter user ‘root’@’localhost’ identified by ‘123456;

set @@GLOBAL.sql_mode=”ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENG INE_SUBSTITUTION”;

use mysql;

update mysql.user set authentication_string=password(‘123456′) where user=’root’ and host=’root’ or host=’localhost’;

FLUSH PRIVILEGES;

grant all privileges on . to ‘root’@’%’ identified by ‘123456’ with grant option;

FLUSH PRIVILEGES;

Use 3.

Mysql -uroot -p123456