It's the one you're using at that moment. That is, it's the one you don't
have to explicitly mention to access its tables. If you connect with
mysql [options] db1
or issue a
command, then db1 is the default database.
This is in the manual <http://dev.mysql.com/doc/mysql/en/USE.html>.
Dr. Frank Ullrich wrote:
> I came across this term several times while reading about character set
> and collation handling, e.g. in the last paragraph of the online manual
> section 10.3.2 (http://dev.mysql.com/doc/mysql/en/Charset-database.html):
> The character set and collation for the default database are available
> as the values of the character_set_database and collation_database
> system variables. The server sets these variables whenever the default
> database changes. If there is no default database, the variables have
> the same value as the corresponding server-level variables,
> character_set_server and collation_server.
> Also in the changes of version 4.1.8 in the "Functionality added or
> changed:" section the first entry reads:
> * For ALTER DATABASE, the database name now can be omitted to apply
> the change to the default database.
> I searched a while but could not find an explanation.
> So the question remains:
> what is the "default database"?