Failed to Start Mysql8.0 in Centos7(vultr)

启动失败


查看日志


原因:内存不足

Solution

成功开启MySQL

获取临时密码

1
2
3
4
grep "A temporary password" /var/log/mysqld.log  
# 修改root密码,必须包含大小写特殊字母
mysql -u root -p
alter user 'root'@'localhost' identified by 'your_password';

使用DBeaver客户端连接失败

1
2
3
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
  Connection refused (Connection refused)

Solution

远程测试端口是否开启

服务器本机查看端口是否开启



原因:防火墙中端口没有开启

1
2
3
4
5
6
7
8
9
10
[root@vultr ~]# firewall-cmd --zone=public --list-ports
[root@vultr ~]# firewall-cmd --zone=public --list-ports | grep 3306
[root@vultr ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@vultr ~]# firewall-cmd --zone=public --add-port=3306/udp --permanent
success
[root@vultr ~]# firewall-cmd --zone=public --list-ports
[root@vultr ~]# firewall-cmd --reload
success
[root@vultr ~]# firewall-cmd --zone=public --list-ports

1
null, message from server: "Host '61.148.199.222' is not allowed to connect to this MySQL server"

服务器本地可以登录

客户端无法登录,Public Key Retrieval is not allowed


修改DBeaver中驱动属性,allowPublicKeyRetrieval属性值改为true

连接成功