MySQL Workbench change name to Schema

3

I'm trying to export / migrate a DB from one server to another, I have the 2 connections in Workbench and the problem is that the bases have different names, I want to take the base to export let's call it test and I want to export it to test1 and test2 .

Exports are created with the Schema test then I can not export it to those other 2 ... does anyone know how to change the name?

One solution would be to change the inserts one by one ... a stick.

Another would be to migrate, export but export one .sql per table so it is a stick when you have many tables ...

Any other ideas?

    
asked by PriNcee 24.03.2017 в 14:28
source

3 answers

1

If you use MySQL 5.1.7 you can use the command:

RENAME db1 TO db2;

This feature was considered dangerous, so it was removed from MySQL 5.1.23

Another alternative you can try is to export a dump, create another database and import the dump, here are the steps:

mysql> mysqldump -hlocalhost -uroot -p db1 > dump.sql
mysql> create database db2;
mysql> mysql -hlocalhost -uroot -p db2 < dump.sql

To delete the db1 use the following command:

mysql> drop database db1;
    
answered by 24.03.2017 в 14:47
1

The easiest thing is that you open the exported file and change the name to the scheme. The same thing happened to me and it's the fastest.

    
answered by 24.03.2017 в 14:30
1

I imagine you mean how to do it graphically with the MySQL WorkBench tool, in that case you just double-click on the name of the database and it will display a configuration panel where you can edit the name, character encoding and so on.

    
answered by 05.07.2017 в 03:36