can i rename database using mydac ? without loosing the data in database ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
drama22
Posts: 6
Joined: Sun 24 Jul 2016 01:27

can i rename database using mydac ? without loosing the data in database ?

Post by drama22 » Fri 23 Sep 2016 11:36

i want to rename database name using mydac can i do that ? also i dont want to lose the database tables data any idea how can i achieve this ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: can i rename database using mydac ? without loosing the data in database ?

Post by ViktorV » Fri 23 Sep 2016 12:46

Since MySQL doesn't allow to rename database, MyDAC doesn't support such functionality.

drama22
Posts: 6
Joined: Sun 24 Jul 2016 01:27

Re: can i rename database using mydac ? without loosing the data in database ?

Post by drama22 » Fri 23 Sep 2016 12:53

can i copy a database tables to another ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: can i rename database using mydac ? without loosing the data in database ?

Post by ViktorV » Fri 23 Sep 2016 13:21

To solve your issue, you can use the TMyDump component. You can use it to backup objects of one database and then restore them to another database. See more details about this component in MyDAC help: https://www.devart.com/mydac/docs/devar ... mydump.htm

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: can i rename database using mydac ? without loosing the data in database ?

Post by eduardosic » Mon 05 Dec 2016 23:51

you can try this:

CREATE DATABASE `NEW_DB_NAME` /*!40100 COLLATE 'latin1_swedish_ci' */;

RENAME TABLE `OLD_DB_NAME`.`table1` TO `NEW_DB_NAME`.`table1`,
`OLD_DB_NAME`.`table2` TO `NEW_DB_NAME`.`table2`,
`OLD_DB_NAME`.`table3` TO `NEW_DB_NAME`.`table3`;

Post Reply