解决端口是0问题,解决mysql无法看到3306端口监听

mysql> show global variables like 'port'; 是0

打开目录

/etc/mysql/mysql.conf.d

修改这段话为

复制代码
[mysqld]
#
# * Basic Settings
#
user            = mysql
 pid-file       = /var/run/mysqld/mysqld.pid
 socket = /var/run/mysqld/mysqld.sock
 port           = 3306
 datadir        = /var/lib/mysql

#skip-grant-tables
# If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir                = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1
mysqlx-bind-address     = 127.0.0.1

其中skip-grant-tables 这个应该是免密码登录,给注释掉,我也不知道为什么跟端口0相关

然后重启数据库

systemctl restart mysql

然后

登录数据库

mysql -uroot -p 123456 1234456是我的密码

然后查看

netstat -lanp | grep 3306

tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN 122309/mysqld

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 122309/mysqld

启动成功 为什么还有个33060不知道

相关推荐
五岳1 小时前
分库分表数据源ShardingSphereDataSource的Connection元数据误用问题分析
java·mysql·爬坑
悄悄敲敲敲2 小时前
MySQL表的约束
数据库·mysql
鼠爷ねずみ2 小时前
SpringCloud前后端整体开发流程-以及技术总结文章实时更新中
java·数据库·后端·spring·spring cloud
九皇叔叔2 小时前
MySQL 数据库 Read View 详解
数据库·mysql·mvcc·read view
Elastic 中国社区官方博客3 小时前
Elasticsearch:圣诞晚餐 BBQ - 图像识别
大数据·数据库·elasticsearch·搜索引擎·ai·全文检索
cui_win4 小时前
Prometheus实战教程 - Redis 监控
数据库·redis·prometheus
JIngJaneIL4 小时前
基于java + vue个人博客系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot
TG:@yunlaoda360 云老大4 小时前
华为云国际站代理商备份策略设置过程中遇到问题如何解决?
服务器·数据库·华为云
SelectDB5 小时前
Doris Catalog 已上线!性能提升 200x,全面优于 JDBC Catalog,跨集群查询迈入高性能分析时代
数据库·数据分析·apache
TAEHENGV5 小时前
进度跟踪模块 Cordova 与 OpenHarmony 混合开发实战
android·javascript·数据库