MySQL – Restore Mysqldump to Different Database Name on Same Host

MySQLmysql-5.7mysqldumprestore

Let's start from the beginning there is a MySQL database with name DB1. As I want to restore the mysqldump backup of DB1 database in DB2. The DB2 database is another database in same Host Server machine.

As I have been restored the DB1 mysqldump backup file to DB2 database through (MySQL Workbench as well as SQLyog Ultimate Tool). The restoration went through successfully restored. But there is no Any tables,Views,Stored Procs,Functions,Triggers and event tables or data present/appears in DB2 database. I have also gone through Restore mysql database with different name but somewhere bed luck.

My Environment is as follows:

Operating system version  :   Microsoft Windows Server 2012 R2 Stanadard
Handware information      :   VMware, Inc. VMware Virtual Platform
Processors                :   Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60 GHz
Intalled memory (RAM)     :   24 GB
Installed MySQL Server version : Server version 5.7.24 community edition
The DEFAULT CHARACTER SET of database : utf8
The Backup of DB1 database is 26 GB.

Note: As I want to all content of database of DB1 in DB2 database.

My question is that how to get DB1 database all (tables,Views,Stored Procs,Functions,Triggers and event tables) data in DB2 in the same host machine.

Best Answer

How to restore mysqldump of one database in different databaseName with content of data in the same host machine

I would like to say that as I am able to restore the backup of DB1 in DB2 with the same host. When I took the mysqldump backup of DB1 from the SQLyog ultimate tool. During the mysqldump backup window just exclude these statements. Which is as follows:

  • Exclude USE database statement
  • Exclude CREATE database statement

After excluding these statements in dump file , I am able to restore the dump backup file at DB2 (Different database name with mysqldump database name) in same host name.

Hope it will helpful to other person.