MySQL8.0.32在Linux下的安装

Install the MySQL8.0 version of Linux

目录

  • Install the MySQL8.0 version of Linux
    • 1、Prepare a Linux server
    • 2、Download the MySQL installation package for Linux
    • 3、Upload the MySQL installation package
    • 4、Create a directory and decompress it
    • 5、Install the MySQL installation package
    • 6、Start the MySQL service
    • 7、Example Query the automatically generated password of user root
    • 8、Change the user password
    • 9、Create user
    • 10、Assign permissions to the 'root' user.

1、Prepare a Linux server

Cloud server or virtual machine can be used;

Linux should be CentOS7;

2、Download the MySQL installation package for Linux

地址:https://dev.mysql.com/downloads/mysql/

MySQL8.0.32在Linux下的安装_第1张图片

3、Upload the MySQL installation package

Here I upload through Xtp,you can also choose your own uploading method.

在这里插入图片描述

4、Create a directory and decompress it

MySQL8.0.32在Linux下的安装_第2张图片

5、Install the MySQL installation package

Here we need to follow exactly the steps to perform rpm operations.
MySQL8.0.32在Linux下的安装_第3张图片

6、Start the MySQL service

  • systemctl start mysqld

MySQL8.0.32在Linux下的安装_第4张图片

  • systemctl restart mysqld
  • systemctl stop mysqld

7、Example Query the automatically generated password of user root

Copy a new session and enter:

  • vi /var/log/mysqld.log

MySQL8.0.32在Linux下的安装_第5张图片

And then we copy the password, enter to “Enter Password”.

MySQL8.0.32在Linux下的安装_第6张图片

Successful connection!

8、Change the user password

After logging in to MySQL, you need to change the automatically generated inconvenient password into a familiar password that is easy to remenber.

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

An error occurs when executing the above SQL because the password is too simple, We can set the password complexity to simple and the password length to 4.

set global validate_password.policy = 0;
set global validate_password.length = 4;

After relaxing the password verification policy, execute the aforementioned command to reset the password.
在这里插入图片描述

在这里插入图片描述

9、Create user

The default ‘root’ user can only access the current node ‘localhost’ and can’t be accessed remotely.We also need to create a root account for remote access.

create user 'root'@'%' identified with mysql_native_password by '1234';

在这里插入图片描述

10、Assign permissions to the ‘root’ user.

grant all on *.* to 'root'@'%';

MySQL8.0.32在Linux下的安装_第7张图片
MySQL8.0.32在Linux下的安装_第8张图片

你可能感兴趣的:(MySQL数据库,linux,mysql,服务器)