安装Mysql-server-5.7随笔

由于业务需求,需要在ubuntu上安装Mysql5.7版本的库。经过一番折腾数据库是装好了。本机可以访问,但是在外部通工具却无法访问,telnet端口,不通。难道是防火墙没关?

root@newings:/var/lib/mysql# systemctl status ufw.service
● ufw.service - Uncomplicated firewall
   Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2018-10-26 16:34:07 CST; 1h 49min ago
 Main PID: 299 (code=exited, status=0/SUCCESS)

Oct 26 16:34:07 newings systemd[1]: Stopping Uncomplicated firewall...
Oct 26 16:34:07 newings ufw-init[21357]: Skip stopping firewall: ufw (not enabled)
Oct 26 16:34:07 newings systemd[1]: Stopped Uncomplicated firewall.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

防火墙是关着的,说明跟防火墙没有关系。同时也查看了客户端的防火墙,也是关着的。telnet其他端口,可以正常访问。没有任何问题

root@newings:/var/lib/mysql# cat /var/log/mysql/error.log
2018-10-26T09:08:02.821686Z 2 [Note] Access denied for user 'root'@'localhost' (using password:

日志中就这么一条错误,其他都是警告,并且跟端口都无关。网上资料也寥寥无几,且不实用,解决不了。突然想到是不是端口没有开起来,看了一下,发现了问题

localhost:mysql (LISTEN) 这里localhost不应是*吗。localhost就表示只能本机访问,其余一切不能访问
root@newings:/var/lib/mysql# lsof -i:3306
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
mysqld  24739 mysql   28u  IPv6 1583441      0t0  TCP localhost:mysql (LISTEN)
root@newings:/var/lib/mysql# 

最后在配置文件中发现有有这么一条参数,该参数默认是打开的,这里写的是什么IP就只能通过什么IP去访问(默认是127.0.0.1也就是本机)

bind-address        = 127.0.0.1

把这条参数注释掉,然后重启mysql数据库即可正常访问。

posted @ 2018-10-26 18:34  小年青。  阅读(962)  评论(0编辑  收藏  举报