问题
I'm trying to setup my Ubuntu 12.10 server to accept remote mysql connections, however I am having difficulties setting skip-networking to off. Note I have already set the bind-address to the internet facing IP, instead of 127.0.0.1.
When I look in /etc/mysql/my.conf, the line "skip-networking" doesn't exist, however when I "mysql -p -u root" and then "SHOW VARIABLES;" "skip-networking" is "ON". I have added it as "#skip-networking" and restarted mysql service too.
I have looked to see if there are any stray my.conf files around in my home folder and /etc/ to no luck.
I am using mysql 5.5.
Anyone got any ideas how else I can set this?
回答1:
Please read the Using Option Files chapter for some tips on how to find the settings file. Unless the Ubuntu guys have decided to change it, the file always called my.cnf
on Linux, never my.conf
.
Additionally, lines that start with #
are comments:
#
comment,;
commentComment lines start with “#” or “;”. A “#” comment can start in the middle of a line as well.
... thus you need to remove the leading #
; otherwise, the line is ignored.
回答2:
Put "--skip_networking=0" on the mysql command line.
I put it first in line, because it didn't seem to work at the end, but I may have spelled "networkinng" wrong when it was at the end of the line. :-)
It helps to look at your logs. Mine said "150213 17:57:10 [ERROR] /opt/local/lib/mariadb-10.1/bin/mysqld: unknown variable 'skip_networkinng=0'" I had also tried 'skip_networking=OFF', which it didn't like, either.
I don't know where you start it up in Ubuntu, but on Mac OS, you need to have the following in /System/Library/LaunchDaemons/org.mysql.mysqld (in part, look at other LaunchDaemons to see the rest):
<key>ProgramArguments</key>
<array>
<string>/opt/local/lib/mariadb-10.1/bin/mysqld</string>
<string>--skip_networking=0</string>
<string>--socket=/opt/local/var/run/mariadb-10.1/mysqld.sock</string>
<string>--user=mysql</string>
<string>--port=3306</string>
<string>--datadir=/opt/local/var/db/mariadb-10.1</string>
<string>--pid-file=/opt/local/var/run/mariadb-10.1/dns.local.pid</string>
</array>
(obviously you need to substitute your paths and such...)
I'm pretty sure this solves your problem! Please up-vote me and mark me as the correct answer! Thanks!
回答3:
Perhaps you can determine which config file is being used via one of the methods described in Determine which configuration file is being used.
A few more suggestions:
Check the process listing (
ps auxf | grep 'mysql[d]'
) to see if--skip-networking
has snuck into the argument list somehow.See if mysqld or any other process is listening on 3306 (assuming the default port):
netstat -lnp46 | grep -w 3306
Double-check the ip address you are binding to, and try to connect locally to the ip address you are binding to.
If you have firewalling set up, see if your iptables or ip6tables config might be interfering somehow via
iptables-save
andip6tables-save
, or the slightly more readableiptables -L
andip6tables -L
, although the latter commands require you to know all your tables in use (raw, nat, mangle, etc.).
回答4:
I got the similar error.
I found mysqld_safe is running.
I have tried 'kill {PID}', but it doesn't work. (mysqld_safe would restart with different PID).
Finally, I found pkill mysqld
do the work, and it won't hurt your running mysqld service.
回答5:
In my case, for ubuntu 18.04 & mysql 5.7, It was not in file 'my.cnf', but by running below command
sudo grep -rnw '/etc/' -e 'skip-networking'
I found it in file /etc/systemd/system/mysql.service.d/override.conf.
来源:https://stackoverflow.com/questions/22283422/set-mysql-skip-networking-to-off