I want to use the gcloud sql instance export
command to export a database, to be imported to another database on the same server.
The problem is that using:
gcloud sql instances export instancename gs://bucket/dbname.sql.gz -d=dbname
adds the below to the top of the sql file:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dbname` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `dbname`;
Since I want to be able to import the sql file to another database with the gcloud sql instance import
, the USE dbname
makes the import go to the dbname database instead of other one.
So is there a way for me to export the database but don't add that to the file? I've searched the documentation of the command and didn't found anything related to that.