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

MySQL 8 new features: Invisible Indexes

background Indexes are a double-edged sword. Whil...

MySQL view principles and basic operation examples

This article uses examples to illustrate the prin...

Example code for using HTML ul and li tags to display images

Copy the following code to the code area of ​​Drea...

MySQL stored procedures and common function code analysis

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

The whole process of node.js using express to automatically build the project

1. Install the express library and generator Open...

Linux sar command usage and code example analysis

1. CPU utilization sar -p (view all day) sar -u 1...

Quickly get started with VUE 3 teleport components and usage syntax

Table of contents 1. Introduction to teleport 1.1...

Solutions to Mysql index performance optimization problems

The optimization created by MySQL is to add index...

Detailed explanation of Socket (TCP) bind from Linux source code

Table of contents 1. A simplest server-side examp...

MySQL 8.0.14 installation and configuration method graphic tutorial (general)

MySQL service 8.0.14 installation (general), for ...

Access the MySQL database by entering the DOS window through cmd under Windows

1. Press win + R and type cmd to enter the DOS wi...