How to install mysql 5.7.26 on centOS7.4

WBOY
Release: 2023-05-28 15:25:06
forward
1097 people have browsed it

Mariadb is installed by default in centos. This is a branch of mysql. However, for needs, mysql still needs to be installed in the system, and after the installation is completed, mariadb can be directly overwritten.

1 Download and install the official mysql yum repository

[root@localhost ~]# wget -i -c

Use the above command directly Downloaded the yum repository for installation, which is about 25kb, and then you can install it directly with yum.

[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
Copy after login

Then start installing the mysql server.

[root@localhost ~]# yum -y install mysql-community-server
Copy after login

This step may take some time. After the installation is completed, the previous mariadb will be overwritten.

2 mysql database settings

First start mysql

[root@localhost ~]# systemctl start mysqld.service
Copy after login

Check the mysql running status, the running status is as shown in the figure:

[root@localhost ~]# systemctl status mysqld.service
Copy after login

centOS7.4安装mysql 5.7.26的方法

Mysql has started to run normally at this time, but if you want to enter mysql, you must first find out the password of the root user at this time. You can find the password in the log file through the following command:

[root@localhost ~]# grep "password" /var/log/mysqld.log
Copy after login

centOS7.4安装mysql 5.7.26的方法

The following command enters the database:

[root@localhost ~]# mysql -uroot -p
Copy after login

Enter the initial password. You cannot do anything at this time because mysql must change the password by default before operating the database:

mysql> alter user 'root'@'localhost' identified by 'new password';
Copy after login

Password setting 12 digits

There is a problem here. When setting a new password, if the setting is too simple, an error will be reported:

centOS7.4安装mysql 5.7.26的方法

The reason is because mysql has The specifications for password setting are specifically related to the value ofvalidate_password_policy:

centOS7.4安装mysql 5.7.26的方法

After setting the password, you are done

The above is the detailed content of How to install mysql 5.7.26 on centOS7.4. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!