Installation and configuration of mysql 8.0.15 under Centos7

Installation and configuration of mysql 8.0.15 under Centos7

This article shares with you the installation and configuration graphic tutorial of MySQL 8.0.15 for your reference. The specific content is as follows

1. Go to the official website and select the MYSQL version under Linux that suits your version.

Follow the numbers on the arrows and perform the operations in sequence to enter the picture below.


Wait for the download to complete. The first step is now complete.

2. Upload the downloaded mysql-8.0.15-el7-x86_64.tar.gz to the Linux system for decompression.

(1) I uploaded this file to the /root/ directory and first checked the files in the /root/ directory. To ensure that this file exists on your system.

cd /root/
ls

(2) Unzip the file.

tar -zxvf mysql-8.0.15-el7-x86_64.tar.gz

Then this directory will be generated under the current /root/ directory.

3. Install mysql.

(1) Install mysql-8.0.15-el7-x86_64 to /usr/local/mysql.

mv mysql-8.0.15-el7-x86_64 /usr/local/mysql //Move the file to the /usr/local/ directory and rename it to mysql

(2) Add the mysql group and user to the system.

groupadd mysql and useradd -r -g mysql mysql

(3) Enter the /usr/local/mysql directory and modify the relevant permissions.

cd /usr/local/mysql //Enter the /usr/local/mysql directory chown -R mysql:mysql ./ //Change the current directory to the mysql user

(4) Initialize MySQL and record the temporary password, which will be used when you log in for the first time.

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 
//After running, a temporary password will be generated

The results are as follows

(5) Check whether the my.cnf file is automatically generated during the initialization process.

cd /etc/ //Enter the /etc/ directory ls | grep my.cnf //Check whether there is a my.cnf file. If there is, it will produce results

(6) After the my.cnf file is generated, go to step 8 to modify the information in the my.cnf file.

(7) If my.cnf is not generated during the initialization process, create a new my-defalut.cnf file and copy it to /etc/my.cnf

touch my-defalut.cnf //Create a new file chmod 755 my-defalut.cnf //Give permissions cp my-defalut.cnf /etc/my.cnf //Copy the file to the /etc/ directory and rename it to my.cnf File name

(8) The information in my.cnf is as follows

[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
socket=/tmp/mysql.sock
pid-file=/usr/local/mysql/$hostname.pid //Note the small detail, $hostname here is the host name of Linux. Generally, everyone's host name is different.
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

(9) Configure environment variables for MySQL.

vim /etc/profile // Open the profile file.
export MYSQL_HOME
MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/lib:$MYSQL_HOME/bin

(10) Set it as a startup item.

Execute the code one by one.

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql //Add executable permissions.
chkconfig --add mysql // Register and start the service

Enter chkconfig --list // Check whether the addition is successful.

Indicates success.

(11) Start the server and log in to MySQL.

service mysql start //Start the server.
mysql -uroot -p //Log in to mysql and then be prompted to enter the password.

Enter the temporary password generated during the initialization process and press Enter. Enter the following page.

This means the installation has been successful.

(12) After entering MySQL, change the password. Otherwise you can't do anything.

alter user 'root'@'localhost' identified by 'your_password';

Then exit; exit, re-enter, and test.

show databases;

At this point, the entire process of installing MySQL version 8.0.15 is over!

Finally, I am just a novice, and I hope you can give me some advice if I have any questions! ! !

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.7 installation tutorials for various versions

MySQL 5.6 installation tutorials for various versions

mysql8.0 installation tutorials for various versions

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:
  • MySQL 8.0.15 installation and configuration tutorial under Win10
  • MySQL 8.0.15 download and installation detailed tutorial is a must for novices!
  • MySQL 8.0.15 installation and configuration method graphic tutorial under Windows
  • MySQL 8.0.15 installation and configuration method graphic tutorial
  • MySQL 8.0.15 winx64 decompression version installation and configuration method graphic tutorial
  • MySQL 8.0.15 installation graphic tutorial and database basics
  • MySQL 8.0.15 installation and configuration graphic tutorial
  • MySQL 8.0.15 installation and configuration graphic tutorial under Win10
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • MySQL 8.0.15 version installation tutorial connect to Navicat.list

<<:  JavaScript macrotasks and microtasks

>>:  How to set static IP in CentOS7 on VirtualBox6 and what to note

Recommend

Detailed explanation of Mysql communication protocol

1.Mysql connection method To understand the MySQL...

Summary of the use of TypeScript in React projects

Preface This article will focus on the use of Typ...

Using js to implement simple switch light code

Body part: <button>Turn on/off light</bu...

Detailed tutorial on installing and using Kong API Gateway with Docker

1 Introduction Kong is not a simple product. The ...

Detailed explanation of CSS counter related attributes learning

The CSS counter attribute is supported by almost ...

MySQL foreign key constraint (FOREIGN KEY) case explanation

MySQL foreign key constraint (FOREIGN KEY) is a s...

Example code for realizing charging effect of B station with css+svg

difficulty Two mask creation of svg graphics Firs...

Analysis of MySQL lock wait and deadlock problems

Table of contents Preface: 1. Understand lock wai...

JavaScript Sandbox Exploration

Table of contents 1. Scenario 2. Basic functions ...

How to install the latest version of docker using deepin apt command

Step 1: Add Ubuntu source Switch to root su root ...

JS implements simple calendar effect

This article shares the specific code of JS to ac...

User Experience Summary

Nowadays, whether you are working on software or w...