如何将mysql端口从0更改为3306? [英] How can I change mysql port from 0 to 3306?

查看:689
本文介绍了如何将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/my.cnf和/etc/mysql/my.cnf中的端口号.但这没用.

I have changed the port number in both /etc/my.cnf and /etc/mysql/my.cnf. 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆