CentOS 6.5 installation mysql5.7 tutorial

CentOS 6.5 installation mysql5.7 tutorial

1. New Features

MySQL 5.7 is an exciting milestone. Based on the default InnoDB engine, it adds new features such as SSL, JSON, and virtual columns. Compared with postgreSQL and MariaDB, MySQL5.7 has done a lot of "shortcomings-making" operations.

2. Upgrade Operation

1. Uninstall the old version

1.1. View MySQL

rpm -qa|grep mysql
rpm -qa|grep mariadb

1.2. Uninstall MySQL

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 the data directory

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

The data directory can be backed up and moved away. When the mysqld service is initialized, it checks whether the data directory exists. If the data directory does not exist, mysqld creates it. If the data directory exists and is not empty (that is, it contains files or subdirectories), mysqld displays an error message and terminates:
[ERROR] --initialize specified but the data directory exists. Aborting.

2. Install MySQL 5.7

2.1. Unzip MySQL 5.7

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

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

If the system version corresponding to the installation package is incorrect, a dependency error related to 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 the rpm packages in sequence according to the dependencies

The dependencies are common→libs→client→server

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

Don't be lazy, the client also needs to be installed...

3. Initialize MySQL 5.7

3.1. Start the mysqld service

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

No manual initialization is required, the startup time is long, please wait patiently

3.2. Check the running status of mysqld

service mysqld status

At this point, we can determine that MySQL has been basically installed successfully.

3.3. Find the temporary login password

vi /var/log/mysqld.log

You can also use this command to find it more quickly: cat /var/log/mysqld.log | grep password. Once you find the random password, you can log in to MySQL.

3.4. Login

mysql -uroot -p

4. Configure MySQL remote access

4.1. Change the root password

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

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

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

4.3. Check the user table and refresh memory permissions

select host, user from user;
FLUSH PRIVILEGES;

4.4. Set up a firewall

vi /etc/sysconfig/iptables

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

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

4.5. Restart the firewall

service iptables restart

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • CentOS6.8 uses cmake to install MySQL5.7.18
  • Detailed tutorial on installing MySQL 5.7.18 under CentOS 6.5
  • Detailed installation and configuration tutorial of mysql5.7 on CentOS
  • Deploy MySQL 5.7.17 binary installation and multi-instance configuration on CentOS 6.5
  • Install mysql5.7.13 using RPM in CentOS 7
  • MySQL 5.7 installation and configuration tutorial under CentOS7 (YUM)
  • Tutorial on compiling and installing mysql5.7 under centos 7 system
  • CentOS 7.2.1511 compile and install Nginx1.10.1+MySQL5.7.14+PHP7.0.11
  • Detailed explanation of how to compile and install PHP7.0.10+MySQL5.7.14+Nginx1.10.1 under CentOS 7.2 (mini version)
  • Linux learning third Centos7 installation mysql5.7.16 database

<<:  Vue uses monaco to achieve code highlighting

>>:  How to build a complete samba server in Linux (centos version)

Recommend

CSS sample code with search navigation bar

This article shows you how to use CSS to create a...

Detailed steps for using AES.js in Vue

Use of AES encryption Data transmission encryptio...

A Brief Analysis of MySQL - MVCC

Version Chain In InnoDB engine tables, there are ...

Detailed explanation of the usage of the alias command under Linux

1. Use of alias The alias command is used to set ...

The latest collection of 18 green style web design works

Toy Story 3 Online Marketing Website Zen Mobile I...

JavaScript to achieve fixed sidebar

Use javascript to implement a fixed sidebar, for ...

Detailed explanation of three ways to import CSS files

There are three ways to introduce CSS: inline sty...

How to set up FTP server in CentOS7

FTP is mainly used for file transfer, and is gene...

How to implement the webpage anti-copying function (with cracking method)

By right-clicking the source file, the following c...

Writing High-Quality Code Web Front-End Development Practice Book Excerpts

(P4) Web standards are composed of a series of sta...

Several ways to hide Html elements

1. Use CSS Copy code The code is as follows: style...

Solution to ES memory overflow when starting docker

Add the jvm.options file to the elasticsearch con...

How to implement rounded corners with CSS3 using JS

I found an example when I was looking for a way t...