PDA

View Full Version : Not connecting across a network to a Knoppix MySQL server



kayl
04-22-2005, 05:07 AM
Running Knoppix 3.81 from CD, I've fired up MySQL and loaded a bunch of data via a USB drive. My Perl scripts work fabulously from LOCALHOST. Ping works to/from this computer so the NICs aren't the problem.

Problem:

I can't seem to connect to the MySQL server across my network. From a different machine (also running Knoppix 3.81 from CD), I type
mysql -h 192.168.1.1 -u username -ppassword

and get:
ERROR 2003: Can't connect to MySQL server on '192.168.1.1' (111)

I've moved and copied back /etc/hosts.allow and /etc/hosts.deny and added the following to /etc/hosts.allow and commented out everything in /etc/hosts.deny
mysql : 192.168.1.* : ALLOW

I tried a bunch of things in /etc/hosts.allow and resorted to:
ALL : ALL@ALL : ALLOW

And, yes, I started INETD since I wasn't sure whether or not I needed to.

Suggestions?

kayl
04-24-2005, 04:32 AM
Problem solved and I'm posting the solution should someone find it helpful:

1) /etc/hosts.allow needs to be told to listen to MYSQL clients. The following three lines does that but change the IP accordingly:

sudo mv /etc/hosts.allow /etc/hosts.allow.bak
sudo cp /etc/hosts.allow.bak /etc/hosts.allow
sudo kwrite /etc/hosts.allow & # Add a line=>mysqld : ALL@192.168.1.* : ALLOW

2) Knoppix defaults to having MYSQLD ignore everything not from LOCALHOST. Comment out the "bind-address = 127.0.0.1" line of /etc/mysq/my.cnf. The following three lines does this.

sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
sudo cp /etc/mysql/my.cnf.bak /etc/mysql/my.cnf
sudo kwrite /etc/mysql/my.cnf &

3) Start (or stop and start) MYSQLD to read the new config file

sudo /etc/init.d/mysql start

4) Set MYSQLs root password

mysqladmin -u root password root

5) Connect to MYSQL as root

mysql -u root -proot

6) Delect anonymous users

delete from mysql.user where User="";
delete from mysql.db where User="";

7) Let root log in from anywhere. You probably don't want let ROOT do this but you can use it as a GO-BY for other users.

GRANT ALL ON *.* TO "root"@"%" IDENTIFIED BY "root" WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

-----

You should be able to go to another computer, and type

mysql -h 192.168.1.1 -u root -proot

and have it connect.

tsfftf
04-15-2009, 09:11 PM
thanks for posting a solution. not many people seem to around here. i ran into this problem trying to set mythtv frontend access to the knoppix backend, but as your posts suggests, the hosts file has something to do with it. i'd assumed the same but wasn't sure how to change it.

commenting out the bind address and giving permissions to access from any host (%) hasn't worked so far so i'm going to try your suggestion as soon as my recording finishes. i'll post back to report whether or not its resolved my problem.

i assumed it may be a problem specific to knoppix as it is a live distro.

tsfftf
04-19-2009, 09:42 PM
i took a look at my file /etc/hosts.allow - it contained the following which prevented connections from external hosts

ALL : ALL@ALL : DENY

commenting it out solved it for me. think this is specific to knoppix.