1、查看mysql进程是否开启

[root@localhost ~]# ps -ef|grep mysql
root      2103     1  0 23:08 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
mysql     2354  2103  0 23:08 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock --port=3306
root      2560  1967  0 23:15 pts/0    00:00:00 grep --color=auto mysql
[root@localhost ~]#

检查发现有开着,若没有mysql相关进程中,则需要启动mysql服务

[root@localhost ~]# /etc/init.d/mysqld stop
Shutting down MySQL....                                    [  确定  ]
[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL.                                            [  确定  ]

mysql安装,配置,开发端口等相关可参考以下链接:

https://mp.csdn.net/console/editor/html/107600939

2、检查防火墙状态

[root@localhost ~]# systemctl status firewalld.service
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: active (running) since 一 2020-08-10 17:23:32 CST; 1 weeks 0 days ago
 Main PID: 851 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─851 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

8月 10 17:23:32 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

这里Active: active (running),所以应该是防火墙墙没关闭的原因

防火墙相关命令可以参考以下链接:

https://mp.csdn.net/console/editor/html/107905109

3、关闭防火墙后,用客户端链接工具重新连接试下,正常是解决,要是还不行可以留言

 

小编在使用mysql时,随手做个记录,希望对大家有所帮助,如还有疑问或者有更好的推荐可留言~

Logo

更多推荐