MySQL 5.7.18 installation and configuration method graphic tutorial (CentOS7)

MySQL 5.7.18 installation and configuration method graphic tutorial (CentOS7)

How to install MySQL 5.7.18 on Linux

1. Download MySQL: Official website https://www.mysql.com/, click Download, scroll to the bottom of the page, download the community version, click all the way down, select General Linux, download the 64-bit one, and pay attention to check MD5
value.

2. Install key steps and post commands directly

[cpp] view plain copy View the code piece derived from my code piece on CODE [root@CentOS MySQL]# tar -xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz -C /usr/local 
[root@CentOS MySQL]# cd /usr/local 
[root@CentOS local]# mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql 
[root@CentOS local]# cd mysql 
[root@CentOS mysql]# mkdir data 
[root@CentOS mysql]# groupadd mysql 
[root@CentOS mysql]# useradd -r -g mysql -s/bin/false mysql 
[root@CentOS mysql]# chown -R mysql:mysql ./ 
[root@CentOS mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 
2017-02-23T07:43:03.404885Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2017-02- 
 
23T07:43:04.442174Z 0 [Warning] InnoDB: New log files created, LSN=45790 
2017-02-23T07:43:04.588507Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 
2017-02-23T07:43:04.646721Z 0 [Warning] No 
 
The existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b5c8e226-f99b-11e6-beb5-b7c1a1e39029. 
2017-02-23T07:43:04.671492Z 0 [Warning] 
 
Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 
2017-02-23T07:43:04.672338Z 1 [Note] A temporary password is generated for root@localhost: I%e=s+lfx9ko 
[root@CentOS mysql]# 
 
bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data 
Generating a 2048 bit RSA private key 
.....................................+++ 
..............................+++ 
writing new private key to 'ca-key.pem' 
----- 
Generating a 2048 bit RSA private key 
.........................................+++ 
.........................+++ 
writing new private key to 'server-key.pem' 
----- 
Generating a 2048 bit RSA private key 
..................................................+++ 
...................................................................................................................................................................................................................+++ 
writing 
 
new private key to 'client-key.pem' 
----- 
[root@CentOS mysql]# cd support-files 
[root@CentOS support-files]# cp my-default.cnf /etc/my.cnf 
[root@CentOS support-files]# gedit /etc/my.cnf 
[root@CentOS support-files]# cp mysql.server /etc/init.d/mysqld 
[root@CentOS support-files]# service mysqld start 
Starting MySQL.Logging to '/usr/local/mysql/data/CentOS.cn.err'. 
. SUCCESS! 
[root@CentOS support-files]# ps aux |grep mysql 
root 18279 0.0 0.0 11764 1576 pts/0 S 17:34 0:00 /bin/sh 
 
/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/CentOS.cn.pid 
mysql 18449 1.9 9.5 1182688 177940 pts/0 Sl 17:34 0:00 /usr/local/mysql/bin/mysqld -- 
 
basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/CentOS.cn.err --pid-file=/usr/local/mysql/data/CentOS.cn.pid 
 
--socket=/tmp/mysql.sock --port=3306 
 
[root@CentOS support-files]# 

Explanation line by line:

Unzip the compressed package to the /usr/local directory to install MySQL in that directory.

Switch to /usr/local and rename the folder you just unzipped to mysql.

Create a data folder under the mysql directory to store MySQL data.

Add the user group mysql.

Add the username mysql to the mysql group.

Change the owner and group of the mysql directory.

Initialize MySQL in two steps:

The first step is to use bin/mysqld. Pay attention to the parameters given later. A temporary password will be generated. Save it and use it to log in to the database later.

The second step , bin/mysql_ssl_rsa_setup, looks like a process for database security. Note the parameters given later.

Change to the support-files directory.

Copy my-default.cnf to /etc/my.cnf. Note that CentOS7 comes with a my.cnf file, which should be overwritten.

Edit the file and modify only lines 18, 19, 20, and 22 as follows

Copy the mysql.server file to /etc/init.d/mysqld , which is mainly responsible for starting MySQL.

Start the mysqld process.

Query the mysql process. There are two: /mysql/bin/mysqld_safe, /mysql/bin/mysqld

3. Subsequent configuration:

Log in to mysql and change the temporary password: /usr/local/mysql/bin/mysql -u root -p Press Enter to enter the temporary password generated during initialization and change the password:

set password for 'root'@localhost=password('xxxxxx' );

Every time you log in to the MySQL client, if you find it troublesome to enter the absolute path, you can create a soft link: ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql, which also saves the trouble of configuring the PATH path.

To start mysqld, use the chkconfig command

chkconfig --add mysqld #Add mysqld service chkconfig --list #List all system services

Check to see if it is turned on at all levels, for example:

chkconfig --level 35 mysqld on 
# Set mysqld to run as a service at levels 3 and 5

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:
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • MySQL 5.7.17 installation and configuration method graphic tutorial (CentOS7)
  • Linux CentOS MySQL 5.7.18 5.7.X Installation Tutorial
  • Detailed instructions for compiling and installing CentOS MySQL 5.7
  • Detailed tutorial on installing MySQL 5.7.6+ from source in CentOS 7
  • Detailed tutorial for installing mysql5.7.18 on centos7.3
  • CentOS7 uses rpm package to install mysql 5.7.18
  • Detailed steps to compile and install MySQL 5.7.13 on CentOS7 system
  • Centos MySQL 5.7 installation and upgrade tutorial
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • Detailed tutorial for installing mysql 5.7 on centOS 7
  • Install and configure MySQL 5.7 under CentOS 7

<<:  Nginx installation and environment configuration under Windows (running nginx as a service)

>>:  How to use Vue-router routing

Recommend

Do you know all 24 methods of JavaScript loop traversal?

Table of contents Preface 1. Array traversal meth...

Detailed View of Hidden Columns in MySQL

Table of contents 1. Primary key exists 2. No pri...

MySQL stored procedures and common function code analysis

The concept of mysql stored procedure: A set of S...

Command to remove (delete) symbolic link in Linux

You may sometimes need to create or delete symbol...

Discuss the development trend of Baidu Encyclopedia UI

<br />The official version of Baidu Encyclop...

MySQL DATE_ADD and ADDDATE functions add a specified time interval to a date

MySQL DATE_ADD(date,INTERVAL expr type) and ADDDA...

Linux implements the source code of the number guessing game

A simple Linux guessing game source code Game rul...

JS interview question: Can forEach jump out of the loop?

When I was asked this question, I was ignorant an...

Undo log in MySQL

Concept introduction: We know that the redo log i...

40 web page designs with super large fonts

Today's web designs tend to display very larg...

React Hooks Detailed Explanation

Table of contents What are hooks? Class Component...

CentOS 8.0.1905 installs ZABBIX 4.4 version (verified)

Zabbix Server Environment Platform Version: ZABBI...

Detailed installation and configuration tutorial of mysql5.7 on CentOS

Install Make sure your user has permission to ins...

How to create your own Docker image and upload it to Dockerhub

1. First register your own dockerhub account, reg...