Bug #90 In 4.0 the mysql client prints "Unknown database ¬(;Ðpöÿ¿(öÿ¿h_@'" at connect
Submitted: 21 Feb 2003 15:59 Modified: 12 Mar 2003 10:29
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1 OS:Any (at least Linux)
Assigned to: CPU Architecture:Any

[21 Feb 2003 15:59] Guilhem Bichot
Description:
I just got this with the bk tree :

[papa@gbichot client]$ ./mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.11-gamma-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

Then I shutdown mysqld, and in the client I do

mysql> select now();
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
ERROR:
Can't connect to the server

Then I restart the mysqld server.
In the client I do 

mysql> connect;
ERROR 1049: Unknown database ¬(;Ðpöÿ¿(öÿ¿h_@'
mysql>

How to repeat:
see Description above
[21 Feb 2003 18:33] jocelyn fournier
I can reproduce the bug with 4.1, just launching mysqld and then typing :

mysql> connect;
ERROR 1049: Unknown database 'ûÿ¿ÁÌ'

'use' displays the same behaviour :

mysql> use;
ERROR 1049: Unknown database 'ûÿ¿ÁÌ    '
[21 Feb 2003 18:35] jocelyn fournier
Another funny result :

mysql> use
ERROR 1049: Unknown database 'help;'

mysql> connect
ERROR 1049: Unknown database 'help;'
[1 Mar 2003 11:06] MySQL Verification Team
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

Fixed in latest tree...
[11 Mar 2003 12:55] jocelyn fournier
I still have the problem in the latest bk tree :

[root@forum] /usr/local/mysql-4.1_build/bin> ./mysql -uroot -p                                                            <21:36:28
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.0-alpha

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use
ERROR 1049: Unknown database '@
mysql> use;
ERROR 1049: Unknown database '
mysql> use;
ERROR 1049: Unknown database '
mysql> connect
ERROR 1049: Unknown database '@
[11 Mar 2003 22:57] jocelyn fournier
It's seems the fix doesn't always works as expected
[12 Mar 2003 10:29] MySQL Verification Team
===== client/mysql.cc 1.118 vs edited =====
*** /tmp/mysql.cc-1.118-16095   Sun Mar  2 00:34:24 2003
--- edited/client/mysql.cc      Wed Mar 12 20:14:48 2003
***************
*** 2452,2460 ****
        ptr++;
      if (*ptr == '\\') // short command was used
        ptr+= 2;
!     while (!my_isspace(system_charset_info, *ptr)) // skip command
        ptr++;
    }
    while (my_isspace(system_charset_info, *ptr))
      ptr++;
    if (*ptr == '\'' || *ptr == '\"' || *ptr == '`')
--- 2452,2462 ----
        ptr++;
      if (*ptr == '\\') // short command was used
        ptr+= 2;
!     while (*ptr &&!my_isspace(system_charset_info, *ptr)) // skip command
        ptr++;
    }
+   if (!*ptr)
+     return (char *)NULL;
    while (my_isspace(system_charset_info, *ptr))
      ptr++;
    if (*ptr == '\'' || *ptr == '\"' || *ptr == '`')