CentOS 6.x installation mysql5.7 record

1. Features of version 57

MySQL 5.7 is an exciting milestone. On the basis of the default InnoDB engine, ssl, json, virtual columns, etc. are added New features. Compared with postgreSQL and MariaDB, MySQL 5.7 has done a lot of "filling in" operations. Although mysql58 has come out on the market, only the upgraded version of windows has been pushed, and there is no real mysql5.8 installation package, indicating that it is still in the testing stage. When mysql58 is stable, I will write the 58 installation tutorial later.

2. Installation operation

1、 Uninstall the old version

1.1、 View MySQL

|1 2|rpm -qa|grep mysql rpm -qa|grep mariadb|
|--------|--------|

1.2、 Uninstall MySQL

|1 2 3 4|rpm -e --nodeps mysql-5.1.73-7.el6.x86_64 rpm -e --nodeps mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64 rpm -qa|grep mysql|
|--------|--------|

1.3、 Delete data directory

|1 2|ls -l /var/lib|grep mysql rm -rf /var/lib/mysql|
|--------|--------|

The data directory can be backed up and removed. The mysqld service checks whether the data directory exists when it is initialized: if the data directory does not exist, mysqld will create it; if the data directory exists and is not an empty directory (that is, contains files or subdirectories), mysqld will display an error message and Abort:
[ ERROR] --initialize specified but the data directory exists. Aborting.

2、 Install MySQL5.7

2.1、 Unzip MySQL5.7

1 tar -xvf mysql-5.7.14-1.el6.x86_64.rpm-bundle.tar

The mysql package is ready (including cent6, cent7)

Link: https://pan.baidu.com/s/1egdiiO2q1lOXtoHWd1yQvQ
Extraction code: 11j1

**By the way, the installation environment is CentOS6.5, so you should use the el6 installation package; CentOS7 should use the el7 installation package. **

If the system version corresponding to the installation package is incorrect, a dependency error about glibc will appear during installation:

**warning: **mysql-community-libs-5.7.14-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libc.so.6(GLIBC_2.14)(64bit) is needed by mysql-community-libs-5.7.14-1.el7.x86_64

2.2、 Install rpm packages in turn according to dependencies

The dependency relationship is common→libs→client→server

1 2 3 4 rpm -ivh mysql-community-common-5.7.14-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.14-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.14-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.14-1.el6.x86_64.rpm

3、 Initialize MySQL5.7

3.1、 Start the mysqld service

1 2 cd ../sbin is the /usr/sbin directory service mysqld start

No need to manually initialize, longer startup time, wait patiently

3.2、 Check the running status of mysqld

1 service mysqld status

So far, it can be judged that MySQL is basically installed successfully

3.3、 Find the temporary login password

1 vi /var/log/mysqld.log

You can also use this command to quickly find cat /var/log/mysqld.log | grep password and find a random password to log in to MySQL

3.4、 log in

1 mysql -uroot -p

4、 Configure MySQL remote access

4.1、 Change root password

1 alter user 'root'@'localhost' identified by 'abc@123';

After 5.6, MySQL has a built-in password enhancement mechanism, and low-strength passwords will report an error:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

4.2、 Add remote login user

1 2 use mysql; GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'abc@123' WITH GRANT OPTION;

' %'represents any address, you can also specify IP

4.3、 Check user table, refresh memory permissions

1 2 select host, user from user; FLUSH PRIVILEGES;

4.4、 Set up firewall

1 vi /etc/sysconfig/iptables

Before -A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited, add

1 - A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

4.5、 Restart firewall

1 service iptables restart

4.6、 Debug mysql57 encoding format

Enter the mysql command line and enter: show variables like'character%';

We need to adjust the database and server to utf8;

First we find the my.cnf file

Modify the content of my.cnf: just add it under the corresponding label (as shown in the figure below), add it without the [mysql] label;

[ mysql]

default-character-set=utf8

[ mysqld]

character_set_server=utf8

collation_server=utf8_general_ci

Restart mysql after saving; service mysqld restart; log in to mysql command line again after restart

Type show variables like'character%';

The following figure shows that the database configuration is complete;

Recommended Posts

CentOS 6.x installation mysql5.7 record
Mysql8.0.15 installation configuration (centos7)
Centos 7 mini installation process record
Centos mysql installation and configuration
Centos6 install mysql 5.7.x series
2019-07-09 CentOS7 installation
centos7_1708 installation
CentOS 7.X system installation and optimization
The latest Centos7 installation Mysql8 guide
Centos7 mysql database installation and configuration
[Switch] CentOS7 64-bit installation mysql tutorial
Centos5 installation guide
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Python - centos6 installation
Centos7.6 operating system installation and optimization record
Centos7 compile and install MySQL8 problem record
CentOS install mysql
Docker installation (CentOS7 installation)
CentOS container installation in Docker uses MySQL
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 docker installation
Ubuntu installation record
CentOS7 install MySQL8
Centos MySQL8 configuration
Novice learning Linux (eight) ---- MySql installation (Centos7)
centos 7.5 install mysql5.7.17
Install MySQL 8.x from source code under CentOS7
MySQL 8.0 installation and deployment under CentOS, super detailed!
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
CentOS online installation RabbitMQ3.7
CentOS6.5 offline install MySQL5.6.26
Install mysql5.7 under CentOS7
lamp (centos7) installation lamp environment
CentOS 7.2 Yum install MySQL 5.6
Centos7 install Mysql8 tutorial
CentOS 6.X install VirtualBox-5.1
Centos7 mqtt cluster installation
Graphical installation of CentOS8
Centos7 install mongodb 4.x
Centos manually install mysql8
Install mysql under Centos 7
CentOS7 reset MySQL8.0 password
Centos7 install Mysql database
Linux notes (1): CentOS-7 installation
Redis3 installation under Centos7
Install mysql5.1 under CentOS6.5
Ubuntu 17.10 installation toss record
CentOS online installation RabbitMQ3.7
Docker CentOS installation method
Linux CentOS 7 installation tutorial
Centos7 docker installation details
Discourse CentOS 8 new installation manual
Install mysql online on centos
centos install mysql through yum
Install ElasticSearch 7.x on CentOS 7
Glusterfs cluster installation on Centos7