Bug #24077 'use database' giving wrong error message upon missing database
Submitted: 8 Nov 2006 9:09 Modified: 30 Jun 2007 0:39
Reporter: Anders Henke Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.28-BK, 4.0.27 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[8 Nov 2006 9:09] Anders Henke
Description:
When entering only 'use ' (note the whitespace) on the mysql monitor cli, 
the cli correctly responds with "USE must be followed by a database name".

When leaving out that whitespace, so entering "use" and directly hitting the ENTER key, the error message is e.g. "ERROR 1049: Unknown database 'f³¿üe³¿'". 

How to repeat:
See Description.

Suggested fix:
The client should read out the right message "USE must be followed by a database name", maybe also without even asking the server to switch databases.
[8 Nov 2006 9:53] Valeriy Kravchuk
Thank you for a bug report. Verified on 4.0.28-BK (but NOT on 5.0.29-BK) on Linux:

openxs@suse:~/dbs/5.0> bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.29-debug Source distribution

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

mysql> use
ERROR:
USE must be followed by a database name
mysql> use
ERROR:
USE must be followed by a database name
mysql> exit
Bye
openxs@suse:~/dbs/5.0> bin/mysqladmin -uroot shutdown
STOPPING server from pid file /home/openxs/dbs/5.0/var/suse.pid
061107 13:35:23  mysqld ended

[1]+  Done                    bin/mysqld_safe
openxs@suse:~/dbs/5.0> cd ../4.0
openxs@suse:~/dbs/4.0> bin/mysqld_safe &
[1] 6393
openxs@suse:~/dbs/4.0> Starting mysqld daemon with databases from /home/openxs/d
bs/4.0/var

openxs@suse:~/dbs/4.0> bin/mysql -uroot --host=127.0.0.1 --port=3340
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
openxs@suse:~/dbs/4.0> bin/mysql -uroot -proot --host=127.0.0.1 --port=3340
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.28-log

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

mysql> use
ERROR:
USE must be followed by a database name
mysql> use
ERROR 1049: Unknown database '-0@РД'
mysql> exit
Bye
openxs@suse:~/dbs/4.0> bin/mysql --version
bin/mysql  Ver 12.22 Distrib 4.0.28, for suse-linux (i686)
openxs@suse:~/dbs/4.0> cd ../5.0
openxs@suse:~/dbs/5.0> bin/mysql -uroot -proot --host=127.0.0.1 --port=3340
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 4.0.28-log

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

mysql> use
ERROR:
USE must be followed by a database name
mysql> use
ERROR:
USE must be followed by a database name
mysql> use
ERROR:
USE must be followed by a database name
mysql> exit
Bye
openxs@suse:~/dbs/5.0> bin/mysql --version
bin/mysql  Ver 14.12 Distrib 5.0.29, for suse-linux (i686) using readline 5.0

So, it is CLIENT bug, really.
[8 Nov 2006 12:37] Anders Henke
Ouch, I've been connecting to the 5.0-server using the 4.0-client. Thanks for correcting the version number.
[30 Jun 2007 0:39] Trudy Pelzer
This problem no longer exists on current versions of MySQL;
tested on 5.0.41 and 5.1.20.