Tutorial on installing MySQL 8.0.11 using RPM on Linux (CentOS7)

Tutorial on installing MySQL 8.0.11 using RPM on Linux (CentOS7)

1. Installation preparation

1. View Linux related information (Linux command line operation)

(1) Check the Linux version to download the corresponding MySQL.

[View Linux information:] uname -a

(2) Check whether MySQL has been installed.

[Check whether mysql is installed]
rpm -qa | grep -i mysql If it has been installed, the relevant package name will be output [If mysql has been installed, delete the relevant files]
rpm -e [--nodeps] package name (the package name here is the name found by the above command)

2. Download MySQL

(1) Official website address

【Official website address:】
https://downloads.mysql.com/archives/community/
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-8.0.11-1.el7.x86_64.rpm

(2) Choose the appropriate version

【Choose the appropriate rpm package】
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-client-8.0.11-1.el7.x86_64.rpm

2. Start installation

1. Transfer files to the /opt directory

Use xFtp6 to transfer the downloaded file from the Windows system to the Linux system (optional, you can download it directly on Linux).

2. Install MySQL using RPM

(1) Step 1: Execute the installation command

rpm -ivh package name [Installation order: (Packages depend on each other, so you must pay attention to the installation order)]
 Install common first
 Reinstall libs (make sure mariadb is uninstalled, centos7 supports mariadb by default but does not support mysql, conflicts will occur if not uninstalled)
 Reinstall the client
 Finally install the server
 [root@localhost opt]# rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
 [root@localhost opt]# rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
 [root@localhost opt]# rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm
 [root@localhost opt]# rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm 
 [root@localhost opt]# rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm 

(2) Step 2: Check whether the installation is successful

【Method 1:】
After mysql is installed successfully, the mysql user and user group will be automatically created.
cat /etc/passwd | grep mysql
cat /etc/group | grep mysql
【Method 2:】
mysqladmin --version

3. Start the mysql service

(1) Step 1: Check whether the current service is started

【Method 1:】
ps -ef | grep mysql
【Method 2:】
service mysqld status

(2) Step 2: Start and stop the MySQL service

【Start mysql service:】
service mysql start
[Shut down mysql service: (optional operation)]
service mysql stop

4. Connect to MySQL

An error occurs when connecting to the database for the first time.

【First login:】
mysql
[If an error message is prompted: (indicating that a password is required)]
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

(1) Solution 1: Check the initial password and use it to log in.

[Solution 1: (Check the initial password for login)]
cat /var/log/mysqld.log | grep password

(2) Solution 2:

[Solution 2: (Edit the my.cnf file to skip the password)]
Find the mysql configuration file (ending with .cnf).
find / -name "*/.cnf"
or:
mysql --help |grep -A 1 'Default options'
Edit the configuration file (my.cnf), find [mysqld], and add
skip-grant-tables # Used to skip password login
Restart the service:
service mysqld restart
Login without password:
mysql

5. Change the initial password

You can enter mysql through the above two methods, but the password is the initial password, or there is no password, which is definitely difficult to operate. A custom password is required.
(1) Set the login password and connect to the database again.

【Set password:】
mysql> ALTER USER root@localhost IDENTIFIED BY '123456';
If an error occurs:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
[Solution: (Execute the following statement)]
mysql> flush privileges;
mysql> ALTER USER root@localhost IDENTIFIED BY '123456';
【Log in again】
mysql -uroot -p

(2) After setting the initial password, you need to edit /etc/my.cnf and remove skip-grant-tables that you added previously.
Restart the service.

[root@localhost /]# vim /etc/my.cnf
[root@localhost /]# service mysqld restart 

Summarize

This is the end of this article about the tutorial on how to install mysql 8.0.11 using RPM in Linux (CentOS7). For more information about installing mysql 8.0.11 using linux rpm, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed tutorial on how to compile and install mysql8.0.29 in CentOS8 deployment LNMP environment
  • CentOS7.5 installation of MySQL8.0.19 tutorial detailed instructions
  • Install CentOS7 in VMware (set static IP address) and install mySql database through docker container (super detailed tutorial)
  • Tutorial diagram of installing mysql8.0.18 under linux (Centos7)
  • Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)
  • Tutorial on installing MYSQL8.X on Centos
  • Tutorial analysis of quick installation of mysql5.7 based on centos7

<<:  Vue parent component calls child component function implementation

>>:  A brief discussion on value transfer between Vue components (including Vuex)

Recommend

Detailed explanation of redo log and undo log in MySQL

The most important logs in the MySQL log system a...

How to install Postgres 12 + pgadmin in local Docker (support Apple M1)

Table of contents introduce Support Intel CPU Sup...

Detailed tutorial on using VMware WorkStation with Docker for Windows

Table of contents 1. Introduction 2. Install Dock...

Introduction to the three essential logs for MySQL database interviews

Table of contents 1. redo log (transaction log of...

Vue detailed introductory notes

Table of contents 1. Introduction 2. Initial Vue ...

Two ways to implement HTML page click download file

1. Use the <a> tag to complete <a href=&...

Web page image optimization tools and usage tips sharing

As a basic element of a web page, images are one ...

Summary of react basics

Table of contents Preface start React Lifecycle R...

Getting Started: A brief introduction to HTML's basic tags and attributes

HTML is made up of tags and attributes, which are...

How to use docker+devpi to build local pypi source

Some time ago, I needed to use pip downloads freq...

JavaScript prototype and prototype chain details

Table of contents 1. prototype (explicit prototyp...

How to install docker under centos and remotely publish docker in springboot

Table of contents 1. Installation of JDK1.8 under...

HTML implements the function of detecting input completion

Use "onInput(event)" to detect whether ...

VMware Workstation 14 Pro installation Ubuntu 16.04 tutorial

This article records the specific method of insta...