change_database_username.php to use RENAME TABLE

Version 1.542

Bugfix
Unfinished

The php script is done: http://files1.directadmin.com/services/all/change_database_username.php but not yet incorporated into change_username.sh script (a few changes needed there) Will need testing before release. -------------------------- http://www.directadmin.com/forum/showthread.php?t=43749 Related to: http://www.directadmin.com/features.php?id=1269 The existing implementation of change_database_username.php is to rename the /var/lib/mysql/user_db folder to the new name. This method is flawed in that newer versions of MySQL can use special characters in the user_db folder name, which do not match the actual database name. Correct implementation is to get the list of databases from mysql itself, eg: SELECT Db from mysql.db WHERE Db LIKE '${username}\\_%' For each databse, create a new one with the new username. Then rename all tables from the old db to the new one. Important part will be checking and matching all settings on that database.. which will be where it may get messy (charset, etc..)

Interested to try DirectAdmin? Get a 30-day Free Trial!