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/
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
5、Install the MySQL installation package
Here we need to follow exactly the steps to perform rpm operations.
6、Start the MySQL service
- systemctl start mysqld
- 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
And then we copy the password, enter to “Enter Password”.
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'@'%';