Home > Database > Mysql Tutorial > Cloud server Centos7 builds MySQL database (learning record)

Cloud server Centos7 builds MySQL database (learning record)

藏色散人
Release: 2020-04-02 08:59:17
forward
2130 people have browsed it

Nonsense at the beginning:

Before my student ID card expired, I quickly bought Tencent Cloud for three years. Why should I use Tencent’s products? Isn’t it because other people’s mini programs support it? Without further ado, let’s get to the point.

1. Download the yum source of MySQL

Centos7 does not have the yum source of MySQL. We download different versions of the source to install different versions of MySQL. You can choose to download it yourself. , or you can download it according to the command selected below.

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
Copy after login

2. Install the downloaded rpm file

rpm -ivh mysql57-community-release-el7-8.noarch.rpm
Copy after login

3. Install Mysql with yum

yum install mysql-server
Copy after login

4 , try to log in to MySQL

mysql -uroot -proot
Copy after login

This place may report an error:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Copy after login

This is a /var/lib/mysql permissions problem, modify the MySQL permissions to the current user

sudo chown -R xxx:xxx /var/lib/mysql
Copy after login

xxx is the current user name and group

Restart the MySQL service

service mysqld restart
Copy after login

5. Failed to log in to obtain the initial password

cat /var/log/mysqld.log | grep password
Copy after login

Among them A temporary password is generated for root@localhost: * localhost: What follows is the initial password.

mysql -uroot -p
Copy after login

Enter the password to log in

6. After successful login, change the initial password first

set global validate_password_policy=0;
set global validate_password_length=4;
alter user 'root'@'localhost' identified by 'root’;
Copy after login

7. In this way, the MySQL installation is complete!

Recommended: "mysql video tutorial"

The above is the detailed content of Cloud server Centos7 builds MySQL database (learning record). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template