Transfer a database from one User to another

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » MySQL / MariaDB » Backup/Restore/Transfer

Transfer a database from one User to anotherLast Modified: Dec 19, 2019, 8:10 pm
This guide will outline the method to transfer a database from one User account to another.  Note, the database will be renamed during the process, changing the name to lead with the new User's username, so any scripts that use it would need to be updated.

This guide has two methods. Please select the appropriate script here:

For most cases, you'd want to include the db users with the DB, so is the default here.

Old Username
New Username
Database Nameolduser_

Before any action, be sure to create a fully backup of your databases.
If you don't access to DirectAdmin, you can create .sql backups with CustomBuild.

To move olduser_dbname to newuser_dbname, run the following:

cd /usr/local/directadmin/scripts
./ olduser_dbname newuser_dbname

After the rename, be sure to go through all website configs that access this database, and update the settings accordingly.

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST