MySQL is a relational database management system that keeps data in different tables instead of putting all data in a large warehouse, which increases speed and flexibility. The SQL language used by MySQL is the most commonly used standardized language for accessing databases.

♛ 1 Download the MySQL installation source


♛ 2 Install the MySQL source

yum localinstall mysql57-community-release-el7-8.noarch.rpm

♛ 3 Check the MySQL source installation status

yum repolist enabled | grep "mysql.*-community.*"

♛ 4 (Optional) Modifying configurations

vim /etc/yum.repos.d/mysql-community.repo

It’s not mandatory. Just take a quick look.

♛ 5 Install MySQL

yum install mysql-community-server

♛ 6 Start the MySQL service

systemctl start mysqld

♛ 7 Check the MySQL running status

systemctl status mysqld.service

♛ 8 Startup automatically

systemctl enable mysqld

systemctl daemon-reload

♛ 9 Change the root login password

9.1 Checking the Default Password of mysql Root

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

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPass4! @Test';

Note: If the original password is not displayed after you enter grep, you can change the default password of mysql by using the following methods:

By adding soft connections

mkdir -pv /var/lib/mysql

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock


Password change statements vary by version:

  • MySQL5.7 the following version is availableUPDATE mysql.user SET Password= Password (' new Password ') where user ='root';
  • MySQL5.7 and later update mysql.user set authentication_string=password('root') where user='root'

♛ 10 Add a remote login user

10.1 Adding a ReadOnly User

GRANT SElECT ON *.* TO 'username'@'%' IDENTIFIED BY "password";

flush privileges;

10.2 Adding Read and Write Users

grant all privileges on *.* to root@localhost identified by 'mysql';

flush privileges;

About the author: Focus on basic platform project development. If you have any questions or suggestions, please feel free to comment! Copyright notice: The copyright of this article belongs to the author and the blog garden, welcome to reprint, but without the consent of the author must retain this statement, and give the original text link in a prominent place on the page of the article. For the record: all comments and messages will be answered as soon as possible. You are welcome to correct your mistakes and make progress together. Or direct private message I support the blogger: if you think the article is helpful to you, you can click on the lower right corner of the article [recommendation]. Your encouragement is the author to adhere to the original and continuous writing of the biggest power! \