Database Name Prefix #mysql50#

  • Post author:
  • Post category:MySql


We recently ran into an issue in which after a migration, several of the clients db names were prepended with the #mysql50# prefix. The db names were formatted as: “#mysql50#dbname”, where it used to be just “dbname”. The clients previous version of MySQL was 5.0 and the new servers MySQL version was 5.1.
Evidently, the change was made internally by MySQL 5.1 because the data directory structure changed between MySQL versions.

To repair this issue, you can either change your queries to retrieve from the new db named “#mysql50#dbname” or you can run this query to upgrade the data directory structure.
(Assuming you have root access)

(Note the backticks (`), that’s not a single quote.)

If you run into the following error:

ERROR 1558 (HY000): Column count of mysql.proc is wrong. Expected 20, found 16.
Created with MySQL 50077, now running 50148. Please use mysql_upgrade to fix this error.

run the following command:

mysql_upgrade -h localhost -u root -p

If running in a Plesk environment:

mysql_upgrade -h localhost -u admin -p`cat /etc/psa/.psa.shadow `

This will update the necessary database entries to the latest version of MySQL. This may also fix the ‘#mysql50#’ database prefix issue. If issues persist, rerun the first step.

More information can be also found at MySQL’s Documentation on the ALTER DATABASE command.


Infoz and thanks go to


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....