hmaddy

Well-Known Member
May 6, 2020
382
39
28
Chennai
cPanel Access Level
Root Administrator
i need to restore one database from one server to new server with new username.

For Eg: Existing database name like cpanelusername1_dbname.sql. i need to restore the content of these database to new server with cpanelusername2_dbname. Is this possible.
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
576
266
138
IN
cPanel Access Level
Root Administrator
Yes possible.
The name of the database backup file doesn't matter much. You can transfer the cpanelusername1_dbname.sql to a new server and with the root user use the below command to restore.

example:
Code:
#mysql database_name < database_backup.sql            (command for root user)
Or
#mysql -u [database_user] -p [database_name] < database_backup.sql            (command for non-root user)
In your case on the new server it will be:
Code:
#mysql cpanelusername2_dbname  <  cpanelusername1_dbname.sql                        (command for root user)
 
  • Like
Reactions: cPRex