Deepin20.1 system installs MySQL8.0.23 (super detailed MySQL8 installation tutorial)

Deepin20.1 system installs MySQL8.0.23 (super detailed MySQL8 installation tutorial)

Download MySQL-8.0.23
Click to download: mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

Unzip the MySQL installation package to a directory (here I choose: /usr/local)

sudo tar -Jxv -f /home/×××shanlin/Downloads/mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz -C /usr/local/

Note: /home/×××shanlin/Downloads/ is the directory where my browser saves files

Create a soft link (easy to operate: you can think of it as giving the mysql-8.0.23-linux-glibc2.12-x86_64 directory an alias called mysql)

sudo ln -s /usr/local/mysql-8.0.23-linux-glibc2.12-x86_64 mysql

Create a directory to store MySQL data (/data/mysql/data) and generate the database connection file mysql.sock (/var/run/mysqld)

sudo mkdir -p /data/mysql/data
sudo mkdir -p /var/run/mysqld

Create mysql user group and user

sudo groupadd mysql
sudo useradd -r -g mysql mysql

Grant permissions to the /data/mysql/data and /var/run/mysqld directories

sudo chown mysql:mysql -R /data/mysql/data
sudo chown mysql:mysql -R /var/run/mysqld

Create a my.cnf file and use the which mysqld command to view the location of mysqld: mine is /usr/local/mysql/bin/mysqld, then use the /usr/local/mysql/bin/mysqld --verbose --help |grep -A 1 'Default options' command to view the location where my.cnf can be created:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf /usr/local/mysql/my.cnf ~/.my.cnf
Check /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/mysql/etc/my.cnf, /usr/local/mysql/my.cnf. If the my.cnf file is not found, create a new my.cnf file in /usr/local/mysql/. The following is the content of the my.cnf file:

[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/data/mysql/data
socket=/var/run/mysqld/mysqld.sock
log-error=/data/mysql/data/mysql.err
pid-file=/data/mysql/data/mysql.pid
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true
default_authentication_plugin=mysql_native_password
#Solve the error Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [client]
port=3306
socket=/var/run/mysqld/mysqld.sock
#Create my.cnf directly with vim and write the above content sudo vim /usr/local/mysql/my.cnf

Configure MySQL environment variables

#mysql 
MYSQL_HOME=/usr/local/mysql
PATH=$PATH:$MYSQL_HOME/bin
export PATH MYSQL_HOME
#Write the above content at the end of the profile file sudo vim /etc/profile
#Environment variables take effect immediately sudo source /etc/profile

Install MySQL

sudo /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data --initialize

After normal installation, it will finally display:
A temporary password is generated for root@localhost: x2yfhWE>0FiR (after the colon is a random password, different for everyone)
Remember the random password after the colon

Start MySQL service

sudo /usr/local/mysql/support-files/mysql.server start

Put the MySQL process into the system process

sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

Create a soft link to MySQL in /usr/bin

sudo ln -s /usr/local/mysql/bin/mysql /usr/bin

Log in to MySQL database using a random password

mysql -u root -p

Set a new password for the root user

alter user 'root'@'localhost' identified by '123456';

This is the end of this article about installing MySQL 8.0.23 on deepin 20.1 system (the most domestically produced Liunx system, the most detailed MySQL 8 installation tutorial). For more relevant content about installing MySQL 8.0.23 on deepin 20.1 system, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Complete step-by-step record of MySQL 8.0.26 installation and uninstallation
  • mysql8.0.23 linux (centos7) installation complete and detailed tutorial
  • MySQL 8.0.23 installation super detailed tutorial
  • MySQL 8.0.22 decompression version installation tutorial (for beginners only)
  • MySQL 8.0.26 installation and simplified tutorial (the most complete on the Internet)

<<:  How to deploy Rancher with Docker (no pitfalls)

>>:  Share CSS writing standards and order [recommended for everyone to use]

Recommend

5 issues you should pay attention to when making a web page

1. Color matching problem <br />A web page s...

Detailed explanation of the principle and function of Vue list rendering key

Table of contents The principle and function of l...

Detailed explanation of Tomcat core components and application architecture

Table of contents What is a web container? The Na...

CSS3 flexible box flex to achieve three-column layout

As the title says: The height is known, the width...

MySQL dual-machine hot standby implementation solution [testable]

Table of contents 1. Concept 2. Environmental Des...

Example of creating circular scrolling progress bar animation using CSS3

theme Today I will teach you how to create a circ...

Summary of MySQL InnoDB locks

Table of contents 1. Shared and Exclusive Locks 2...

Example of using #include file in html

There are two files a.htm and b.htm. In the same d...

MySQL 8.0.15 installation and configuration method graphic tutorial

This article records the installation and configu...

Table of CSS Bugs Caused by hasLayout

IE has had problems for a long time. When everyone...

Nodejs implements intranet penetration service

Table of contents 1. Proxy in LAN 2. Intranet pen...

Vue implements file upload and download functions

This article example shares the specific code of ...