You are not logged in.

#1 2011-05-08 05:41:43

mencargo
Member
Registered: 2009-05-05
Posts: 54

[SOLVED] MySQL Server issues

I just installed a fresh ArchLinux, restored a backup from an Ubuntu natty, everything works except my MySQL server connections.

I cannot connect with odbc or jdbc, I'm using the latest versions available:

$ pacman -Q mysql unixodbc myodbc jre
mysql 5.5.12-1
unixodbc 2.3.0-1
myodbc 5.1.8-1
jre 6u25-1

$ mysql -u mencargo -p
Server version: 5.5.12 Source distribution

mysql> use etlcontroltf;
Database changed
mysql>

$ cat /etc/odbcinst.ini 
[MySQL]
Description     = ODBC Driver for MySQL
Driver          = /usr/lib/libmyodbc5.so

$ cat .odbc.ini 
[MySQL]
Description     = MySQL ODBC
Driver          = MySQL
Server          = localhost
Database        = etlcontroltf
Port            = 3306
Socket          = /var/run/mysqld/mysqld.sock

$ isql MySQL -v
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/libmyodbc5.so' : file not found
[ISQL]ERROR: Could not SQLConnect

$ lsd /usr/lib/libmyodbc5.so
lrwxrwxrwx 1 root 19 Mar 17 09:05 /usr/lib/libmyodbc5.so -> libmyodbc5-5.1.8.so

For JDBC I'm trying to use mysql-connector-java-5.1.16-bin.jar with DBvisualizer, getting:

Product:  DbVisualizer Free 7.1.5
Build:  #1590 (2011/02/24 17:23)
Java VM:  Java HotSpot(TM) 64-Bit Server VM
Java Version:  1.6.0_25
Java Vendor:  Sun Microsystems Inc.
OS Name:  Linux
OS Arch:  amd64
OS Version:  2.6.38-ARCH

An error occurred while establishing the connection:

Long Message:
Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Details:
   Type: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
   Error Code: 0
   SQL State: 08S01

A curious thing about the odbc is that the Arch guide suggests a /usr/lib/libodbcmyS.so file that is not present in my system, or any libodbcmySX.so nor libmyodbcSX.so.
Anyway, jdbc doesn't have anything to do with odbc, and it's also not working, so maybe it's my server config?

$ cat /etc/mysql/my.cnf 

[client]
port        = 3306
socket        = /var/run/mysqld/mysqld.sock

[mysqld]
port        = 3306
socket        = /var/run/mysqld/mysqld.sock
datadir        = /var/lib/mysql
skip-external-locking
key_buffer_size = 64M
max_allowed_packet = 2M
table_open_cache = 64
sort_buffer_size = 1M
net_buffer_length = 512K
read_buffer_size = 2M
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 16M
bind-address = 127.0.0.1
server-id = 1

[mysqldump]
quick
max_allowed_packet = 64M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 32M
sort_buffer_size = 32M
read_buffer = 16M
write_buffer = 16M

Or is this version of the server broken?

Last edited by mencargo (2011-06-03 05:49:11)

Offline

#2 2011-05-08 11:53:16

Pajaro
Member
Registered: 2004-04-21
Posts: 883

Re: [SOLVED] MySQL Server issues

try commenting the line "skip-networking" in /etc/mysql/my.cnf

Offline

#3 2011-05-08 23:35:50

mencargo
Member
Registered: 2009-05-05
Posts: 54

Re: [SOLVED] MySQL Server issues

The my.cnf code posted is the whole config, I don't have skip-networking.

$ telnet localhost 3306
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
$ netop
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1483/mysqld         
tcp        0      0 127.0.0.1:3306          127.0.0.1:43098         TIME_WAIT   -

The port seems open but I'm getting disconnected immediately.

Any thoughts?

Last edited by mencargo (2011-05-09 02:04:58)

Offline

#4 2011-05-09 07:55:16

Pajaro
Member
Registered: 2004-04-21
Posts: 883

Re: [SOLVED] MySQL Server issues

The my.cnf code posted is the whole config, I don't have skip-networking.

Sorry, I read too fast

Offline

#5 2011-05-09 17:12:13

hiciu
Member
Registered: 2010-08-11
Posts: 81

Re: [SOLVED] MySQL Server issues

Java tries to connect to mysql via tcp, and mysqld is, by default, blocked by tcpwrappers. To confirm try `nc localhost 3306` or `mysql -u root -p --protocol=TCP`, I assume none of them will work.

To fix it add "mysql: LOCAL" or "mysql: ALL" to /etc/hosts.allow or comment out "ALL: ALL" in /etc/hosts.deny. Run `man 5 hosts_access` for full howto smile.

Offline

#6 2011-05-09 18:08:46

mencargo
Member
Registered: 2009-05-05
Posts: 54

Re: [SOLVED] MySQL Server issues

Thank for the info hiciu, I have some weird results:

$ nc localhost 3306 -v
localhost [127.0.0.1] 3306 (mysql) open
$ mysql -u root -p --protocol=TCP
Enter password: 
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0QL server at 'reading initial communication packet', system error: 0
$ cat /etc/hosts.allow
mysql:127.0.0.1

I'll try with ALL:ALL just to be sure, and I'm currently considering migrating to H2 database.

Last edited by mencargo (2011-05-09 18:09:17)

Offline

#7 2011-05-09 18:13:52

hiciu
Member
Registered: 2010-08-11
Posts: 81

Re: [SOLVED] MySQL Server issues

mencargo wrote:
$ cat /etc/hosts.allow
mysql:127.0.0.1

mysqld. And it will work smile.

Offline

#8 2011-05-09 20:59:50

mencargo
Member
Registered: 2009-05-05
Posts: 54

Re: [SOLVED] MySQL Server issues

Holy smokes!!! That was it!

I'm feeling like jumping out the window!
:S

Sorry for this terrible user mistake.

Thanks for your time!

Offline

Board footer

Powered by FluxBB