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

Examples of correct use of maps in WeChat mini programs

Table of contents Preface 1. Preparation 2. Actua...

Detailed explanation of new relational database features in MySQL 8.0

Preface The latest version of MySQL 8.0 is 8.0.4 ...

Four ways to combine CSS and HTML

(1) Each HTML tag has an attribute style, which c...

Summary of MySql index, lock, and transaction knowledge points

This article summarizes the knowledge points of M...

Solution to the error when calling yum in docker container

When executing yum in dockerfile or in the contai...

How to choose and use PNG, JPG, and GIF as web image formats

So which one of these formats, GIF, PNG, and JPG,...

Implementation example of nginx access control

About Nginx, a high-performance, lightweight web ...

JavaScript canvas implements graphics and text with shadows

Use canvas to create graphics and text with shado...

About Nginx gzip configuration

The principle of nginx to achieve resource compre...

Briefly describe the difference between Redis and MySQL

We know that MySQL is a persistent storage, store...

Solutions to MySQL OOM (memory overflow)

OOM stands for "Out Of Memory", which m...

Vue3 compilation process-source code analysis

Preface: Vue3 has been released for a long time. ...

HTML head structure

The following introduces the commonly used head s...