HiveBrain v1.2.0
Get Started
← Back to all entries
gotchasqlMinor

Strange MySQL database that I can't select

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canstrangedatabasemysqlthatselect

Problem

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;
    -> ;
ERROR: 
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)

Solution

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

SHOW VARIABLES LIKE 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /db-data/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec)


Which will give you the location of data directory

Code Snippets

SHOW VARIABLES LIKE 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /db-data/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec)

Context

StackExchange Database Administrators Q#34385, answer score: 7

Revisions (0)

No revisions yet.