centos7 installs MySQL 5.17 online and configures remote access

Keywords: MySQL yum RPM Asterisk

Environmental Science:
centos7
mysql5.7
Installation: Official Yum Repository
Other notes:

  • If you need to install other versions, please switch rpm version by yourself. This installation version is 57, that is, the asterisk position is "57".
  • After MySQL 5.7, the password policy does not allow weak passwords to appear. To modify the password, it is recommended that special symbols of capital letters, lowercase letters and numerals be used.
  • The password modification command after MySQL 5.7 is partially different from the previous one.
  • The command from mysql client, remember not to throw away';'

Installation of MySQL 5.7

  1. Download and install MySQL's official Yum Repository

[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql*********-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql*********-community-release-el7-10.noarch.rpm

  1. Install mysql service

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

II. Start up and configure

  1. Startup service

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

  1. View state

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

  1. View the initial password and log in

[root@localhost ~]# grep "password" /var/log/mysqld.log
[root@localhost ~]# mysql -uroot -p
password [Enter the initial password found]
Note: At the beginning of the next step, when using the initial password, errors may be reported and various operations may not be allowed. You can modify a more complex custom password and change policies or other operations after you have permission.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

  1. View password policy

mysql>SHOW VARIABLES LIKE 'validate_password%';

+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

Modify policy items:
Reason: You can set 123456, otherwise?
If the password is unchanged, it is recommended that the length of capital letters + lowercase letters + numbers + special symbols be more than 8 bits.

set global validate_password_policy=0;
set global validate_password_mixed_case_count=0;
set global validate_password_special_char_count=0;
set global validate_password_length=6;

Configuration of remote login authority

  1. Configure remote login authorization

mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES; # You must remember this step.
quit

Settle

  1. Unload Yum Repository to avoid each yum triggering update operation

[root@localhost ~]# yum -y remove mysql*********-community-release-el7-10.noarch

Posted by shawngibson on Tue, 01 Oct 2019 12:36:42 -0700