Install MySQL 5.7.18 using rpm package under CentOS 7

Install MySQL 5.7.18 using rpm package under CentOS 7

I have been using MySQL recently. The article mysql-installation under Linux wrote about using other methods to install MySQL. This time I mainly used the rpm format to install it. After trying it, I felt that this installation mode was simpler.

Uninstall MariaDB

CentOS7 installs MariaDB instead of MySQL by default. There may be a conflict between MariaDB database and MySQL, so uninstall MariaDB first.

1. Check the installed MariaDB related packages
rpm -qa | grep mariadb
2. Check the installed MariaDB related yum packages. The packages need to be determined according to the results of the rpm command.
yum list mariadb-libs
3. Remove the installed MariaDB related yum packages. The package name needs to be determined according to the result of the yum list command. This step requires root privileges.
yum remove mariadb-libs

Download mysql rpm package

Below is the download address of the official website:
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

Install mysql using rpm

The following steps require root privileges. There are dependencies between packages, so the rpm commands must be executed in sequence.

mkdir mysql
tar -xv -f mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql
cd mysql
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm

Problems:

1) libaio.so.1()(64bit) is needed by MySQL-server

Solution:

Install libaio-0.3.107-10.el6.x86_64.rpm

①Download address:

http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm

②Execute: rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm

2) net-tools is needed

Solution:

yum install net-tools

3) perl (Getopt::Long) is needed by mysql-community-server-5.7.18-1.el7.x86_64

Solution:

yum install perl

After successful installation, delete the installation files and temporary files, or you can choose not to delete them.

Log in to mysql and change the initial password

The following steps require root privileges.
1. Since you don’t know the password at the beginning, first modify the configuration file /etc/my.cnf to let mysql skip the permission verification when logging in. Add a line:

vi /etc.my.cnf
skip-grant-tables 

2. Change the user and group of the MySQL database directory, and then start mysql

chown -R mysql:mysql /var/lib/mysql/ 
systemctl start mysqld.service //Start the mysql database service

3. Login

mysql -uroot -p

4. Change password

use mysql; 
update user set authentication_string =password('your own password') where host ='localhost' and user='mysql';
quit;

5. Log in again using your password

mysql -uroot -p

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:
  • CentOS7 uses rpm to install MySQL 5.7 tutorial diagram
  • Detailed tutorial on installing mysql 8.0.13 (rpm) on Centos7
  • Installation tutorial of mysql8.0rpm on centos7
  • Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • CentOS7 uses rpm package to install mysql 5.7.18
  • Tutorial on installing MySQL 5.7.9 using RPM package under CentOS 7
  • Install mysql5.7.13 using RPM in CentOS 7
  • CentOS7 detailed installation of MySQL using rpm
  • Brief analysis of centos 7 mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

<<:  Summary of nginx configuration location method

>>:  Detailed explanation of Nginx static service configuration (root and alias instructions)

Recommend

Use viewport in meta tag to define screen css

<meta name="viewport" content="w...

CSS solves the misalignment problem of inline-block

No more nonsense, post code HTML part <div cla...

How to use HTML 5 drag and drop API in Vue

The Drag and Drop API adds draggable elements to ...

How to monitor the running status of docker container shell script

Scenario The company project is deployed in Docke...

A detailed discussion of components in Vue

Table of contents 1. Component Registration 2. Us...

Detailed explanation of eight methods to achieve CSS page bottom fixed

When we are writing a page, we often encounter a ...

The difference and usage of Vue2 and Vue3 brother component communication bus

Table of contents vue2.x vue3.x tiny-emitter plug...

Summary of Form Design Techniques in Web Design

“Inputs should be divided into logical groups so ...

Prevent HTML and JSP pages from being cached and re-fetched from the web server

After the user logs out, if the back button on the...

MySQL storage engine basics

In the previous article, we talked about MySQL tr...

JavaScript to implement input box content prompt and hidden function

Sometimes the input box is small, and you want to...

SQL left join and right join principle and example analysis

There are two tables, and the records in table A ...