[racket] Got some trouble the the mysql-connect

From: MingQian Zhang (zmingqian at qq.com)
Date: Mon Nov 21 00:09:41 EST 2011

Thanks, Ryan  !


Here are two mysql servers I can't connect:
1. 
mysql  Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline 6.2
Connection id:          6747
Current database:
Current user:           ***@***
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.77-log Source distribution
Protocol version:       10
Connection:             *** via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
TCP port:               3306
2. 

mysql  Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline 6.2
Connection id:          332085
Current database:
Current user:           ***@***
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.5.9-log MySQL Community Server (GPL)
Protocol version:       10
Connection:             *** via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
TCP port:               3306



And these two servers I can connect correctly:
1.
mysql  Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline 6.2
Connection id:          68
Current database:
Current user:           root at localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.58-1ubuntu1 (Ubuntu)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /var/run/mysqld/mysqld.sock
Uptime:                 3 hours 28 min 28 sec
 
2. 
mysql  Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline 6.2
Connection id:          12
Current database:
Current user:           ***@***
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.56-log Source distribution
Protocol version:       10
Connection:             *** via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
TCP port:               3306



------------------ Original ------------------
From:  "Ryan Culpepper"<ryan at cs.utah.edu>;
Date:  Sat, Nov 19, 2011 03:30 AM
To:  "MingQian Zhang"<zmingqian at qq.com>; 
Cc:  "users"<users at racket-lang.org>; 
Subject:  Re: [racket] Got some trouble the the mysql-connect

 
On 11/18/2011 12:23 AM, MingQian Zhang wrote:
> Hi all:
>
> I got some errors when using new (require db) module.
> Here are the two errors:
> 1. io:read-null-terminated-bytes: internal error: communication problem
> (unexpected EOF)
> 2. parse-packet: internal error: communication problem (expected
> authentication ok packet)
>
> The whole thing is like this:
> 1. write my code like this:
> (require db)
> (define sql-exp
> (mysql-connect #:server "my sql server ip"
> #:port 3306
> #:database "name"
> #:user "user"
> #:password "password"))
>
> 2. when I run this code , I met my problems:
> I have two mysql servers to connect, they are in different ips.
>
> when use the code to connect 1 , I got Error 1:
> io:read-null-terminated-bytes: internal error: communication problem
> (unexpected EOF)
>
> Then I tried to connect server 2, I got another error:
> parse-packet: internal error: communication problem (expected
> authentication ok packet)
>
> 3. other tries
> After got the errors, I tried to connect a localhost server,
> Like this :
> (define test
> (mysql-connect #:server "localhost"
> #:port 3306
> #:database "test"
> #:user "root"))
>
> It's OK and no error happens.
>
> Then I tried this in a virtual machine like this
> (define test
> (mysql-connect #:server "10.0.2.2"
> #:port 3306
> #:database "test"
> #:user "root"))
> It's OK , too.
>
> Also I tried postgresql, it's OK , too.
>
> Can you help me to figure out what's wrong when connecting my mysql server ?
> Thanks very much!

I'll look into this. What version of MySQL is each of the servers 
running? In particular, does it succeed with one version and fail with 
another? And are any of the servers configured to reject non-SSL 
connections?

Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111121/70ae57fb/attachment.html>

Posted on the users mailing list.