我发现很难在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?
发布评论