当前位置:   article > 正文

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

mysql 8.0.37 端口为0

1.系统版本,mysql版本:

e42709620fab4a0580cafd1cdc251921.png

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

#远程连接授权

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

6e3b21128a16b5f46ea52b52ccb697ba.png

一般是按照/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

原文:https://www.cnblogs.com/wfpanskxin/p/13061351.html

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号