MySQL 8.0.16 installation and configuration tutorial under CentOS7

MySQL 8.0.16 installation and configuration tutorial under CentOS7

Uninstall the old version of MySQL (skip this step if you don’t have one)

( Note: When reinstalling a new version of MySQL in steps 3-6, be sure to uninstall the previous version completely to avoid errors; when installing MySQL for the first time on a new virtual machine, only steps 1-2 are required)

1. View old versions of MySQL

rpm -qa | grep mysql

2. Delete old components one by one

Use the rpm -e --nodeps {-file-name} command to remove the files. There may be dependencies when removing the files, so pay attention to the order.

After deleting, check to see if there are any old versions.

3.rm -rf /var/lib/mysql
rm /etc/my.cnf

4.find / -name mysql

Clear all directories and files related to MySQL and other configurations and settings. If so, delete it. It is also necessary to consider that other software will not be affected.

rm -rf /usr/lib/mysql
rm -rf /usr/share/mysqlwhereis mysql

6. Self-starting service

chkconfig --list | grep -i mysql
chkconfig --del mysqld

Install MySQL

1. Upload the MySQL installation package to the /usr/local/mysql/ folder on centos

insert image description here

2. Enter /usr/local/mysql/

3. Start installing MySQL

Run the rpm -ivh {-file-name} command to perform the installation operation.
Install the rpm packages in order according to the dependencies: common→libs→client→server
Note: In ivh, i-install installation; v-verbose progress bar; h-hash hash verification

rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm

Solution to errors when installing libs;

Clear all mysql dependency packages in yum yum remove mysql-libs

4. Installation successful

5. Start mysql

After installation, start the MySQL service using the command: (If the mysql service cannot be started, restart the system)

systemctl start mysqld.service (service mysqld start) starts mysql
systemctl status mysqld.service (service mysqld status) View mysql status systemctl stop mysqld.service (service mysqld stop) Shut down mysql

6. Change MySQL password

First use the following command to find the password:

grep 'temporary password' /var/log/mysqld.log

Login to mysql with password

mysql -uroot -p

To change your password:

alter user root@localhost identified by 'your password'; 

insert image description here

(Note that the password here should be as complex as possible, otherwise it will fail (ERROR 1819 (HY000): Your password does not satisfy the current policy requirements)

(If you want to make the password simpler, you need to execute the following two commands first:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1; )


7. Login

mysql -uroot -p

8. Check the mysql process ps -ef | grep mysql

9. Check port 3306 netstat -anop | grep 3306

10. Grant remote access to the root user

1) use mysql;

2) select user, host from user;

3) update user set host='%' where user = 'root';

4) grant all privileges on . to 'root'@'%' identified by 'tsk007' with grant option;

5) flush privileges;

insert image description here

11.systemctl stop firewalld.service (turn off the firewall)
systemctl disable firewalld.service (turn off the firewall at boot)

12. Remote login (MySQL must be installed on this machine)

mysql -uroot -p -h (accessed IP)

Reference article: How to completely uninstall MySQL under CentOS

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:
  • Detailed steps to install MYSQL8.0 on CentOS7.6
  • Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)
  • Detailed tutorial on installing mysql 8.0.13 (rpm) on Centos7
  • CentOS7 uses yum to install mysql 8.0.12
  • Detailed steps for installing and configuring MySQL 8.0 on CentOS
  • CentOS7 installation GUI interface and remote connection implementation
  • Tutorial on installing MySql5.7 in CentOS7.2 and enabling remote connection authorization
  • Reasons and solutions for being unable to remotely connect to MySQL database under CentOS7
  • How to install MySql in CentOS 8 and allow remote connections

<<:  Specific use of Bootstrap5 breakpoints and containers

>>:  Docker uses the mysqldump command to back up and export mysql data in the project

Recommend

CSS margin overlap and how to prevent it

The vertically adjacent edges of two or more bloc...

Basic use of javascript array includes and reduce

Table of contents Preface Array.prototype.include...

MySQL transaction autocommit automatic commit operation

The default operating mode of MySQL is autocommit...

How to add vector icons to web font files in web page production

As we all know, there are two types of images in c...

Common commands for deploying influxdb and mongo using docker

Deploy database based on docker sudo docker pull ...

Hello dialog box design experience sharing

"What's wrong?" Unless you are accus...

Vue Router vue-router detailed explanation guide

Chinese documentation: https://router.vuejs.org/z...

How to add Tomcat Server configuration to Eclipse

1. Window -> preferences to open the eclipse p...

Markup Languages ​​- Lists Again

Click here to return to the 123WORDPRESS.COM HTML ...

How to use the Linux more command in Linux common commands

more is one of our most commonly used tools. The ...

Summary of Linux file directory management commands

touch Command It has two functions: one is to upd...

Implementation of deploying Apollo configuration center using docker in CentOS7

Apollo open source address: https://github.com/ct...

Implementing a web player with JavaScript

Today I will share with you how to write a player...

Detailed installation process of MySQL5.6.40 under CentOS7 64

MySQL5.6.40 installation process under CentOS7 64...

Linux Check the installation location of the software simple method

1. Check the software installation path: There is...