Installation of Mysql5.7 in Centos6

  • 2021-08-21 21:44:37
  • OfStack

Environment

Centos 6.6

Mysql 5.7

Installation

If the system is installed, please uninstall it first!

Turn off Selinux

setenforce 0 (temporary shutdown) Modification/etc/selinux/config (permanent shutdown)
Replace SELINUX=enforcing with SELINUX=disabled

1. Download the dependency package and the installation package for mysql

Official website download decompression:


wget http://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.15-1.el6.x86_64.rpm-bundle.tar
tar -xvf mysql-5.7.15-1.el6.x86_64.rpm-bundle.tar

Step 2 Install


rpm -ivh mysql-community-common-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.15-1.el6.x86_64.rpm

(1) For MySQL 5.7. 6 and later, the initial random root password is written to the log (default location/var/log/mysqld. log)

(2) Do not create an MySQL anonymous account

(3) Do not create a test database

3. Start mysqld

If mysql users are missing, create them yourself;


adduser -g mysql mysqlysql

Before starting, you need to check whether the data directory exists, as follows:

If the data directory does not exist, mysqld will create it.

If the data directory exists and is not empty (that is, contains files or subdirectories)


service mysqld start

Modify root login password


mysql  In fact, in fact, the uroot  In fact, in fact, the p

The password entered here is the initial password generated under/var/log/mysqld:


alter user 'root'@'localhost' identified by 'Mysql$%123';

Use the initialization command if necessary:


mysqld --initialize --user=mysql (In a Secure Way) 
mysqld --initialize-insecure --user=mysql (Non-secure mode) 

4. Check whether mysql is self-starting and set to turn on self-starting


chkconfig --list | grep mysqld
chkconfig mysqld on

Version change


thread_concurrency

5.7 The default setting is 0, which means that the number of concurrency is not limited. It is recommended to set it to 0 here, so as to give full play to the multi-core processing capability of CPU and improve the concurrency. Since mysql5.6. 1, this option has been abolished.

The above is the site to introduce the installation method of Mysql5.7 in Centos6, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!


Related articles: