I am investigating a web site server (CentOS release 6.3) that runs the traditional lamp stack;

I am getting the following output my MySQL;

mysql> show databases;
| Database           |
| information_schema |
| #mysql50#.config   |
| webtestdb          |
| mysql              |
| test               |
| websitedb          |
6 rows in set (0.00 sec)

What is "#mysql50#.config"? Also, I can't select it;

mysql> use #mysql50#.config;
    -> ;
USE must be followed by a database name
mysql> use \#mysql50\#.config;
No connection. Trying to reconnect...
Connection id:    1707
Current database: *** NONE ***

ERROR 1049 (42000): Unknown database 'mysql50.config'
mysql> use `#mysql50\#.config`;
ERROR 1102 (42000): Incorrect database name '#mysql50#.config'

Does this resemble some sort of crashed database, or a temporary database from a previous import or export than has been left behind by mistake?

mysql> SHOW VARIABLES LIKE "%version%";
| Variable_name           | Value               |
| protocol_version        | 10                  |
| version                 | 5.1.67-log          |
| version_comment         | Source distribution |
| version_compile_machine | x86_64              |
| version_compile_os      | redhat-linux-gnu    |
5 rows in set (0.00 sec)

This is nothing but a folder/file in database directory.

The default location for data directory is /var/lib/mysql on ubuntu.Go to that location(datadir) and find what is there in that folder if it not your database please move that to some another place.

If you need to find the location of data directory issue command on MySQL shell

| Variable_name | Value           |
| datadir       | /db-data/mysql/ |
1 row in set (0.00 sec)

Which will give you the location of data directory

  • This is correct. I ran into this situation by having my btrfs snapshot directory inside the data directory. Turns out that's a no-no. On a subvolume /secure/home/mysql/, make sure you put your data inside /secure/home/mysql/data/, so /secure/home/mysql/.snapshots/ won't confuse the server. – lkraav Feb 3 '16 at 2:58

OK, so it seems that his has occurred because someone has left some files (one called conf) in the MySQL user's home directory. Removing them has removed this weird database.

  • In my case there was, for some reason, a directory named conf.d in /var/lib/mysql. I have no idea why the #mysql50# is prepended, but removing that directory removed the problem. – Confusion Jul 22 '16 at 9:25
  • I had an unusable database named #mysql50#.ssh. Your answer lead me to squeamishly delete from /var/lib/mysql, a folder named .ssh. This caused the mystery database to disappear and no longer prevented mysqlcheck and mysqldump from throwing the bad name error. – David Nov 14 '18 at 14:55

This can also occur when the folder name contains a . when copied or renamed on the filesystem:

mysql> show databases;
| Database           |
| ...                |
| hashvb             |
| hashvb.bak         |
| hashvb2            |
| hashvb3            |
| ...                |
4+ rows in set (0.01 sec)

mysql> use hashvb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> use hashvb.bak
ERROR 1102 (42000): Incorrect database name 'hashvb.bak'
mysql> use `hashvb.bak`
ERROR 1102 (42000): Incorrect database name 'hashvb.bak'

After renaming it on the file system to not include the ., mysql can use it as normal.


I have been dealing with this problem on multiple servers. I have 3 solutions...

1/Delete the offending directories! But they may return

2/ Tell MySQL Server to ignore them... That is modify "my.cnf" file in the "[mysqld]" section..


And restart MySQL server...

3/ Modify the "automysqlbackup" which is generally the thing reporting problems with these 'databases' existing.

The problem is that simple attempts to add those database names to $DBEXCLUDE does not appear to work, and the scripts programming when processing "$DBNAMES" = "all" may need to be modified.

See... http://www.ict.griffith.edu.au/anthony/info/apps/mysql.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.