Bug #58274 Default database -> No database selected
Submitted: 18 Nov 2010 0:55 Modified: 6 Jan 2011 13:32
Reporter: charl retief Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.30 OS:Linux (Ubuntu 10.10 64bit)
Assigned to: Maksym Yehorov CPU Architecture:Any
Tags: No database selected

[18 Nov 2010 0:55] charl retief
Description:
In the SQL Editor window the 'default database' option does not work for a server with only 1 database.

The one database is selected in the dropdown, but whenever you run sql commands you get "Error Code: 1046 (No database selected)".

A workaround does exists: you can type "use `dbname`;" at the top of any script to select your database.

How to repeat:
1) Open a SQL Editor on a server with only 1 database
2) The 'default database' looks like it is selected as the only database
3) Type SQL that uses the database ex (SELECT * FROM `.....`)
4) Run query

5) Results = Error Code: 1046 (No database selected)

Suggested fix:
For a server with only 1 database make the 'default database' selected as the one database.
[18 Nov 2010 1:43] MySQL Verification Team
Could you please try version 5.2.29.? Thanks in advance.
[24 Nov 2010 22:12] charl retief
version 5.2.30 is still has the same problem
[25 Nov 2010 18:41] Valeriy Kravchuk
Looks like a duplicate of Bug #58443. Please, check.
[25 Nov 2010 18:49] charl retief
Bug #58443 describes the same problem.

It is in fact a duplicate of this one as it was submitted 6 days after this one!
[26 Nov 2010 10:42] Valeriy Kravchuk
Bug #58443 was marked as a duplicate of this one.
[26 Nov 2010 15:03] Maksym Yehorov
fixed.
[8 Dec 2010 21:09] Johannes Taxacher
fix confirmed in repository
[6 Jan 2011 13:32] Tony Bedford
An entry has been added to the 5.2.31 changelog:

In the SQL Editor, selecting the default database where the server only contained a single database had no effect. To avoid a “No database selected” error, the database had to be selected via script using the USE statement.