Bug #3744 embedded server, wrong error message if database directory is missing
Submitted: 13 May 2004 13:00 Modified: 21 May 2004 19:26
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version: OS:
Assigned to: Alexey Botchkov CPU Architecture:Any

[13 May 2004 13:00] Matthias Leich
Description:
AFAIK every well working MySQL database has a directory with the database name 
containing files for the tables etc.
If somebody removes that directory or assigns a non existing database as option 
this database cannot be accessible and he must get an error message.

Example with syntactic well formed option database=xmysql... within the command 
line 

standard server -> ERROR 1049: Unknown database 'xmysql'
                   This error message gives useful informations.

embedded server -> 1046: No Database Selected
     This message suggests that the user forgot to write the database name into
     an appropriate place, which leads an unexperienced user into a totally 
     wrong direction. 

My environment: Linux(SuSE 9.0), MySQL 4.1 source distribution
                                 (last bk pull ~ 7.5.2004)

How to repeat:
Take a well working database:
start the server
<source distrib>/libmysqld/examples/mysql --defaults-file=<my_config> \
     -user=root --database=mysql -e "show tables"
should give something like
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv    |
| db              |
| func            |
...

<source distrib>/client/mysql --defaults-file=<my_config> --user=root \
   --database=xmysql -e "show tables"     xmysql does not exist
should give 
ERROR 1049: Unknown database 'xmysql'

stop the database server
now try
<source distrib>/libmysqld/examples/mysql --defaults-file=<my_config> \ 
    --user=root --database=xmysql -e "show tables"
You will get the wrong message
ERROR 1046 at line 1: No Database Selected

Suggested fix:
The embedded server should also give the error message
ERROR 1049: Unknown database 'xmysql'
[17 May 2004 8:42] Alexey Botchkov
bk commit - 4.1 tree (hf:1.1855)
[21 May 2004 19:26] Alexey Botchkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html