ready:
- VirtualBox
- Centos7
- MySQL 5.7
1. Download from MySQL official website mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
,
tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7 # 解压
Unzip the file:
2. Execute the command to install:
yum install mysql-community-{
server,client,common,libs}-* mysql-5.*
Profile:/etc/my.cnf
.
3. Start the mysql service:
systemctl start mysqld
4. Set the root password
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password'; # 修改root密码
When setting a password, it may appear:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
This is a problem with mysql password policy,
show variables like 'validate_password%'; # 查看密码策略
set global validate_password_policy=LOW; # 修改密码策略
参考:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
5. Remote login
5.1 Turn off the firewall
If the above error is reported, execute the command to turn off the firewall:
systemctl stop firewalld.service
Reference: centOS7 permanently close the firewall (basic use of the firewall)
Let MySQL 5.2 allows remote login
to continue to use Navicat Premium
to access the following errors:
Log mysql modify the configuration:
mysql> use mysql
mysql> select host from user where user = 'root';
+-----------+
| host |
+-----------+
| localhost |
+-----------+
1 row in set (0.00 sec)
mysql> update user set host = '%' where user = 'root';
mysql> FLUSH PRIVILEGES;
mysql>
Reference: Host is not allowed to connect to this MySQL server solution