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

Pure CSS to achieve three-dimensional picture placement effect example code

1. Percentage basis for element width/height/padd...

Example of creating table statements for user Scott in MySQL version of Oracle

Overview: Oracle scott user has four tables, whic...

Detailed explanation of Angular component projection

Table of contents Overview 1. Simple Example 1. U...

Method to detect whether ip and port are connectable

Windows cmd telnet format: telnet ip port case: t...

Best Practices for Implementing Simple Jira Projects with React+TS

A set of projects for training react+ts Although ...

Detailed tutorial on installing SonarQube using Docker

Table of contents 1. Pull the image 1.1 Pull the ...

Using keras to judge SQL injection attacks (example explanation)

This article uses the deep learning framework ker...

Definition and function of zoom:1 attribute in CSS

Today I was asked what the zoom attribute in CSS ...

js to implement collision detection

This article example shares the specific code of ...

Detailed explanation of the available environment variables in Docker Compose

Several parts of Compose deal with environment va...

Detailed tutorial on downloading mysql on Windows 10

MySQL versions are divided into Enterprise Editio...

Vue implements Modal component based on Teleport

Table of contents 1. Get to know Teleport 2. Basi...

AsyncHooks asynchronous life cycle in Node8

Async Hooks is a new feature of Node8. It provide...

Three ways to delete a table in MySQL (summary)

drop table Drop directly deletes table informatio...