CentOS7 uses rpm package to install mysql 5.7.18

CentOS7 uses rpm package to install mysql 5.7.18

illustrate

This article was written on 2017-05-20, using MySQL-5.7.18. The operating system is 64-bit CentOS Linux release 7.2.1511 (Core), installed as a desktop.

Uninstall MariaDB

CentOS7 installs MariaDB instead of MySQL by default, and the MySQL-related packages are also removed from the yum server. Because MariaDB and MySQL may conflict, uninstall MariaDB first.

1. Check the installed MariaDB related rpm packages.

rpm -qa | grep mariadb

2. Check the installed MariaDB-related yum packages. The package name needs to be determined according to the result 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

Since the software package is very large, you can download it using other methods (such as Thunder) first. Using the rpm method, you can also install it without an internet connection - this is something that yum cannot do. If you need to install other versions of MySQL, please go to the official website and search for the corresponding rpm download link.

Copy the code as follows:
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

Install MySQL using rpm package

The following steps require root privileges. And because of the dependencies between packages, each rpm command must be executed in sequence.

mkdir mysql-5.7.18
tar -xv -f mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.18
cd mysql-5.7.18/
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

After successful installation, you can also delete the installation files and temporary files.

cd ..
rm -rf mysql-5.7.18
rm mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

Change the initial MySQL 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 check when logging in. Add a line:

skip-grant-tables

2. Restart MySQL.

service mysqld restart

3. Log in to MySQL without password.

mysql

4. Execute the following command in the mysql client to change the root password.

use mysql;
UPDATE user SET authentication_string = password('your-password') WHERE host = 'localhost' AND user = 'root';
quit;

5. Modify the configuration file /etc/my.cnf to delete the previously added line skip-grant-tables and restart MySQL. This step is very important and failure to perform it may lead to serious safety issues.

6. Log in using the password you just set.

mysql -u root -p

7.MySQL will force you to change your password, and it cannot be a simple rule password.

ALTER USER root@localhost IDENTIFIED BY 'your-new-password';

The steps may seem a bit cumbersome, and I haven't thought of any other solution yet, so just use it this way for now.

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
  • Install MySQL 5.7.18 using rpm package under CentOS 7
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • 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

<<:  jQuery treeview tree structure application

>>:  Detailed explanation of software configuration using docker-compose in linux

Recommend

How to create a basic image of the Python runtime environment using Docker

1. Preparation 1.1 Download the Python installati...

How to install docker on centos

Here we only introduce the relatively simple inst...

Detailed Introduction to MySQL Innodb Index Mechanism

1. What is an index? An index is a data structure...

Standard summary for analyzing the performance of a SQL statement

This article will introduce how to use explain to...

A mobile adaptive web page effect solves the problem of small display page

For work needs, I need to make a mobile phone adap...

Tutorial on installing php5, uninstalling php, and installing php7 on centos

First, install PHP5 very simple yum install php T...

An article to help you understand the basics of VUE

Table of contents What is VUE Core plugins in Vue...

React Principles Explained

Table of contents 1. setState() Description 1.1 U...

Summary of various forms of applying CSS styles in web pages

1. Inline style, placed in <body></body&g...

Detailed explanation of CSS margin collapsing

Previous This is a classic old question. Since a ...

Summarize the common application problems of XHTML code

<br />For some time, I found that many peopl...

Navicat for MySQL scheduled database backup and data recovery details

Database modification or deletion operations may ...

win10 mysql 5.6.35 winx64 free installation version configuration tutorial

mysql 5.6.35 winx64 free installation version con...

Detailed examples of using JavaScript event delegation (proxy)

Table of contents Introduction Example: Event del...