linux mysql8 端口号为 0 port mysql8 远程连接失败 2003 can't mysql connect

1.系统版本,mysql版本:

linux mysql8 端口号为 0 port  mysql8 远程连接失败 2003 can't mysql connect

 

 

 一般情况下没有如果是权限原因或者防火墙原因就不说了网上资料多的一塌糊涂  但是简单说一下几个命令:

#远程连接授权
grant all privileges on *.* to root@%;
FLUSH PRIVILEGES;

#修改密码
ALTER USER root@% IDENTIFIED WITH mysql_native_password BY 密码; 
FLUSH PRIVILEGES;

2.查找my.cnf文件

mysql --help|grep my.cnf

linux mysql8 端口号为 0 port  mysql8 远程连接失败 2003 can't mysql connect

 

 

 一般是按照/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

这个优先级来读取的

3.my.cnf简单参数设置:

[client]
port= 3306
socket = /usr/local/mysql/mysql.sock
default-character-set=utf8

[mysqld]
port= 3306
mysqlx=0
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /usr/local/mysql/mysql.sock
character-set-server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#skip-grant-tables #一定注意此参数 会影响下面参数是导致端口号为0的罪魁祸首
#skip-networking
bind-address = 0.0.0.0

[mysql]
port= 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
bind-address = 0.0.0.0

 将

#skip-grant-tables  注释掉后端口号就不为零 了 
#skip-networking 也要注释掉
bind-address = 0.0.0.0 开放任意IP

linux mysql8 端口号为 0 port mysql8 远程连接失败 2003 can't mysql connect

上一篇:psql: FATAL: the database system is in recovery mode


下一篇:Album++:分布式事务专辑-XA 解决方案