Tutorial on installing MySQL under Linux

Tutorial on installing MySQL under Linux

Preface:

The previous article introduced the MySQL installation tutorial under Windows in detail. This article starts with the most basic installation of MySQL-Linux environment. Interested friends can follow me. The series of articles will be continuously updated. Come on, let's make progress together!

1. Delete the old version

Check whether the server has built-in MySQL . If so, you can use it directly. If the built-in version is lower, you can delete it and install the version you want (before installing the new version of MySQL, you need to uninstall the server's built-in MySQL package and the MySQL database branch mariadb package)

rpm -qa|grep mysql -- Check whether the server has mysql . If yes, execute the following statement to delete it.

rpm -qa |grep mariadb -- Check whether the server has mariadb . If yes, execute step 3 to delete it.

rpm -e --nodeps file name to be deleted (nodeps means forced deletion)

2. Check the server kernel type, download the appropriate version and upload it to the server

2.1. Use cat /proc/version to view the kernel type of the system

2.2. Download the appropriate type from the official website

2.3. Upload to the server via rz command or xftp tool

Note: If the command cannot be found when using the rz command, directly execute: yum -y install lrzsz to download it online.

Command: rz or rz -be

Format: rz -be Select the file to upload

Upload files in batches or individually through the ZMODEM protocol. In addition, you can also upload via ftp or sftp

Note: If you think that uploading via the rz command takes a long time, you can download an xftp tool, which is more efficient (this article will not expand on this tool. If you need it, you can leave a message below. A detailed introduction will be published later.)

3. Unzip and install the corresponding components step by step

3.1. Decompression command

tar -xvf the file name to be decompressed -C the path to be compressed (-C and the following parameters can be omitted)

3.2. Install component command: rpm -ivh component name to be installed

Follow the following command sequence and change the file name to the name of the compressed file.

//mysql-community-common
1. rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm

//mysql-community-libs
2. rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm --force --nodeps

//mysql-community-libs-compat
3. rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm

//mysql-community-client
4. rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm --force --nodeps

//mysql-community-server
5. rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm --force --nodeps

// View installed components 6. rpm -qa | grep mysql

3.3. Start the MySQL server. If an error occurs, proceed to step 4.

Start command: systemctl start mysql

3.4. If the following error is reported during startup, perform the corresponding steps to repair it

Error message: Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details .

According to the error information, run the "systemctl status mysqld.service" or "journalctl -xe" command to view the error details. You will find that the error information contains: Data Dictionary upgrade from MySQL 5.7 in progress.

The explanation is that there is a conflict between the new version and the previous version of the server. Just delete the corresponding conflicting directory and execute: rm -rf /var/lib/mysql/* (be careful when executing the deletion command)

3.5. Execute after repair is completed

systemctl start mysql starts the MySQL service

4. Connect to MySQL service and change password

The first time you successfully start MySQL, a default password will be set. Use the following command to view and log in.

  • View the temporary password for the first startup: grep password /var/log/mysqld.log
  • Connect to the server: mysql -u root -p Enter, then enter the password
  • The first connection will force you to change the connection password. You can use the following statement to change the password:

ALTER USER root@localhost IDENTIFIED WITH caching_sha2_password BY '123456'; (MySQL 8.x is suitable for this statement)

UPDATE USER SET PASSWORD=PASSWORD('your password') WHERE USER='root'; (modification of MySQL 5.x version)

This is the end of this article about installing MySQL under Linux. For more information about installing MySQL under Linux, 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:
  • Tutorial on installing mysql5.7.36 database in Linux environment
  • Introduction to the process of installing MySQL 8.0 in Linux environment
  • Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary
  • MySQL multi-instance deployment and installation guide under Linux
  • MySQL 8.0.25 installation and configuration tutorial under Linux
  • mysql8.0.23 linux (centos7) installation complete and detailed tutorial
  • Detailed tutorial on installing MySQL database in Linux environment
  • Detailed tutorial on installing mysql-8.0.20 under Linux
  • Linux system MySQL8.0.19 quick installation and configuration tutorial diagram
  • Tutorial on installing mysql8 on linux centos7
  • Install MySQL database in Linux environment

<<:  How to use display:olck/none to create a menu bar

>>: 

Recommend

Detailed method of using goaccess to analyze nginx logs

Recently I want to use goaccess to analyze nginx ...

Web design must also first have a comprehensive image positioning of the website

⑴ Content determines form. First enrich the conten...

Simple implementation of vue drag and drop

This article mainly introduces the simple impleme...

Nginx Linux installation and deployment detailed tutorial

1. Introduction to Nginx Nginx is a web server th...

Descending Index in MySQL 8.0

Preface I believe everyone knows that indexes are...

Summary of common sql statements in Mysql

1. mysql export file: SELECT `pe2e_user_to_compan...

Implementation of master-slave replication in docker compose deployment

Table of contents Configuration parsing Service C...

How to modify the default encoding of mysql in Linux

During the development process, if garbled charac...

Implementation of Vue 3.x project based on Vite2.x

Creating a Vue 3.x Project npm init @vitejs/app m...

An audio-visual Linux distribution that appeals to audiophiles

I recently stumbled upon the Audiovisual Linux Pr...

Implementation of running springboot project with Docker

Introduction: The configuration of Docker running...

Detailed process of configuring NIS in Centos7

Table of contents principle Network environment p...

css3 animation ball rolling js control animation pause

CSS3 can create animations, which can replace man...

How to use MySQL covering index and table return

Two major categories of indexes Storage engine us...