如何将mysql端口从0更改为3306?

编程入门 行业动态 更新时间:2024-10-23 19:30:47
本文介绍了如何将mysql端口从0更改为3306?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发现很难在jdbc和mysql之间建立链接.我认为原因之一是mysql端口.我用以下语句检查了端口:显示类似'port'的变量;"在mysql中.答案是

I find it hard to establish a link between jdbc and mysql. I think one of the reasons is the mysql port. I checked the port with the statement: "show variables like 'port';" in mysql.And the answer is

+---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 0 | +---------------+-------+ 1 row in set (0.07 sec)

我的操作系统是archlinux. 如何将mysql端口从0更改为3306?

My operating system is archlinux. How can I change mysql port from 0 to 3306?

我已经更改了/etc/myf和/etc/mysql/myf中的端口号.但这没用.

I have changed the port number in both /etc/myf and /etc/mysql/myf. But it didn't work.

推荐答案

首先检查SHOW VARIABLES LIKE 'skip_networking';如果它报告skip_networking = On,则在没有网络支持的情况下启动mysqld(端口中的值为0系统变量).

First of all check what SHOW VARIABLES LIKE 'skip_networking'; if it reports skip_networking = On, your mysqld is started without networking support (which leads to an value of 0 in the port system variable).

在这种情况下,您很可能必须检查mysqld的初始化脚本(最有可能在/etc/init.d/mysql下),在此处搜索--skip-networking并注释掉(删除)此部分.完成此过程后,您必须重新启动mysqld.

If this is the case, you most likely have to check the init scripts for your mysqld, its most likely under /etc/init.d/mysql, search here for --skip-networking and comment out (delete) this part. After this procedure you have to restart your mysqld.

通常,无需显式设置端口3306,因为3306是mjysqld侦听的默认端口.

Normaly there is no need to set the port 3306 explicitly since 3306 is the default port for mjysqld to listen on.

更多推荐

如何将mysql端口从0更改为3306?

本文发布于:2023-08-07 14:16:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   端口   mysql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!