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

JavaScript simulation calculator

This article shares the specific code of JavaScri...

mysql 5.7.18 winx64 password change

After MySQL 5.7.18 is successfully installed, sin...

Basic introductory tutorial on MySQL partition tables

Preface In a recent project, we need to save a la...

Detailed explanation of Windows time server configuration method

Recently, I found that the company's server t...

Use pure CSS to create a pulsating loader effect source code

Effect Preview Press the "Click to Preview&q...

Detailed process of using nginx to build a webdav file server in Ubuntu

Install nginx Note that you must install nginx-fu...

Introduction to several ways to introduce CSS in HTML

Table of contents 1. Embed CSS styles directly in...

Interpretation and usage of various React state managers

First of all, we need to know what a state manage...

How to optimize MySQL deduplication operation to the extreme

Table of contents 1. Clever use of indexes and va...

Vue implements three-level navigation display and hiding

This article example shares the specific code of ...

npm Taobao mirror modification explanation

1. Top-level usage 1. Install cnpm npm i -g cnpm ...

Detailed explanation of Apache website service configuration based on Linux

As an open source software, Apache is one of the ...

mysql add, delete, modify and query basic statements

grammar Here is the generic SQL syntax for INSERT...

JavaScript custom plug-in to implement tab switching function

This article shares the specific code of JavaScri...