0

I have a MySQL server with a number of databases on it - 16 if I'm not mistaken.

When I run the SHOW DATABASES command I get 30 rows.

I would have expected 17 rows: The 16 databases and "information_schema".

I do however get 13 rows where the database name is prefixed and postfixed with a "?". Does anybody know what that means?

When I look at the database folder I see my 16 databases, but also the 13 weird databases but here they are pre- and postfixed with @feff

Does anybody know what that means?

I have no idea how these databases got there - I just want to get rid of them.

Can I just delete the database folders?

1

You need to make sure they do not contain any tables

Please run this query

select 
    table_schema AS BlankDatabases 
from
    (select 
        A.table_schema, COUNT(B.table_schema) table_count 
     from
        (select 
            schema_name AS table_schema
        from 
            information_schema.schemata
        where 
            schema_name not in ('information_schema','mysql','performance_schema')
        ) A
        left join
        (select 
            table_schema
        from 
            information_schema.tables
        where 
            table_schema not in ('information_schema','mysql','performance_schema')
        ) B
        using (table_schema)
    group by 
        A.table_schema
    ) AA 
where 
    table_count = 0;

This will tell you which databases do not have any tables

For example, let's say you run that query and get the following output

mysql> select table_schema BlankDatabases from
    -> (select A.table_schema,COUNT(B.table_schema) table_count from
    -> (select schema_name table_schema
    -> from information_schema.schemata
    -> where schema_name not in
    -> ('information_schema','mysql','performance_schema')) A
    -> left join
    -> (select table_schema
    -> from information_schema.tables
    -> where table_schema not in
    -> ('information_schema','mysql','performance_schema')) B
    -> using (table_schema)
    -> group by A.table_schema
    -> ) AA where table_count = 0;
+----------------+
| BlankDatabases |
+----------------+
| junk           |
| test           |
+----------------+
2 rows in set (0.00 sec)

mysql>

You can just run

DROP DATABASE junk;
DROP DATABASE test;

In your case, you should surround the database names with back quotes (`)

DROP DATABASE `@feff...@feff`;

If you are having a hard time, go to the OS and remove the folder.

For example, if your datadir is /var/lib/mysql and you are removing @feff...@feff, do this

cd /var/lib/mysql
rm -rf "@feff...@feff"

GIVE IT A TRY !!!

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.