Utilize shell scripts,linux commands, open source tools,java, to Maximize the Power of Linux.
Focused on working with linux and shell, search engine technology including Chinese segmenter
Any questions please contact me at gmail: david.ullua

4/09/2007

mysql error -- /etc/rc.d/rc.mysqld restart

in Slackware 11, when i connect mysql (5.0.24a) by ip/remotely:

$mysql -u roboo -h 172.16.100.30 -p

error showed as following:
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '172.16.100.30' (111)

i googled around, someone said can edit the my.cnf , comment this line:
skip-networking
but there isn't any my.cnf on the file system. even type locate my.cnf,nothing
happened, i got stuck on the problem. then tried to find which configuration
file (my-huge.cnf, my-large.cnf, my-medium.cnf, my-small.cnf ?) mysql is
using, and didn't find anything in /usr/bin/mysqld-safe. however, find
something useful by ps command:

$ps aux|grep mysql
root 3896 0.0 0.0 2328 432 ? S 08:56
0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid --skip-networking
mysql 3921 0.0 0.5 52840 5416 ? S 08:56
0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysql/mysql.pid --skip-locking --skip-networking
mysql 3922 0.0 0.5 52840 5416 ? S 08:56
0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysql/mysql.pid --skip-locking --skip-networking
mysql 3923 0.0 0.5 52840 5416 ? S 08:56
0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysql/mysql.pid --skip-locking --skip-networking
.....

yes,--skip-networking is the key.it means when mysqld is started,
a "--skip-networking" parameter is passed. I opened /etc/rc.d/rc.mysqld ,
and see this line:
SKIP="--skip-networking"

and in the later lines SKIP is taken as a parameter of mysqld. so comment the
SKIP line, restart mysqld.
#/etc/rc.d/rc.mysqld restart

it works!

About Me

I am a senior developer and a team leader with 3 years development experience in Suzhou, China, focus on mobile web search, linux, Java and machine learning in NLP (natural language processing). My goal is to improve people's life with computer technology.