Install mysql5.7 in Linux. Follow Han Shunping

Install mysql5.7 in Linux. Follow Han Shunping

1. Preparation before installation

If we need to develop JavaEE under Linux, we need to install the following software
Data download address: Baidu network disk
cloud disk
Extraction code: zruq

Here we can download the following 2
insert image description here

2. Installation

1. Create a new folder /opt/mysqland cd into it

mkdir /opt/mysql
cd /opt/mysql

insert image description here

2. Run wget http://dev.mysql.com/get/mysq1-5.7.26-1.el7.x86_ _64.rpm-bundle.tar to download the mysql installation package

PS: The mysql-like database that comes with centos7.6 is mariadb, which will conflict with mysql and must be deleted first.

Here we upload the mysql package in the data into /opt/mysqlthe directory through Xftp
insert image description here
to check whether the upload is successful

ll

insert image description here

3. Run decompression

tar -xvf mysql-5.7.26- 1.e17.x86_ _64.rpm-bundle.tar 

insert image description here

4. Run rpm -qalgrep mari to query mariadb related installation packages

rpm -qa|grep mari

Found that there is indeed mariadb
insert image description here

5. Run rpm -e --nodeps mariadb-libs, uninstall

rpm -e --nodeps mariadb-libs
rpm -e --nodeps marisa

It is found that the deletion is successful
insert image description here
6. Then start to actually install mysql, and run the following in turn

rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm

7. Run systemctl start mysqld.service to start mysql

systemctl start mysqld.service

insert image description here

8. Then start to set the root user password
Mysql automatically sets a random password for the root user, run grep "password" /var/log/mysqld.log to see the current password

grep "password" /var/log/mysqld.log

The temporary password is as follows:
insert image description here

9. Run mysql -u root -p, log in with the root user, prompt to enter the password can be used above, you can successfully log in to the mysql command line

mysql -u root -p

login successful
insert image description here

10. Set the root password. For the personal development environment, if you want to set a relatively simple password (the production environment server needs to set a complex password), you can run

set global validate_password_policy=0; 

Prompt password setting policy
(validate_ password_ policy default value 1,)
insert image description here

11.set password for ‘root@’ localhost’ =password(hspedu100’);

set password for 'root'@'localhost'=password('hspedu100');

12. Run flush privileges; make the password settings take effect

flush privileges;

If the password set here is less than 8 characters, you can change the password policy

# 查看 mysql 初始的密码策略。
SHOW VARIABLES LIKE 'validate_password%'; 
# 设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 
set global validate_password_policy=LOW;
# 设置 validate_password_length 的全局参数为 6 
set global validate_password_length=6;
# 如果是小于4位的密码可以把数字设置为0
set global validate_password_number_count=0;

insert image description here
Note: The production library password must be complex

Supongo que te gusta

Origin blog.csdn.net/sinat_38316216/article/details/129679298
Recomendado
Clasificación