1

I am trying to create a copy of database in mysql using mysqldbcopy like :

mysqldbcopy --source=root:xxx@13.67.59.xxx --destination=root:xxx@13.67.59.xxx old_db:new_db

I am getting error saying cannot connect to the destination server (Error code 110). Source and destination is same server. I want to know which user and ip i need to put here, whether to put mysql username and password or server username and password. Please help me out in this.

  • why don't we can use mysqldump for this? any issues? it would be simple to take backup using mysqldump -uuser dbname >backup.sql and then restore using mysql -uroot newdb <backup.sql – Nawaz Sohail Oct 21 '16 at 13:55
  • Could you add the exact error message? You might try --source=root:pass@localhost:port and actually use localhost instead of using the IP address. – John aka hot2use May 26 '17 at 8:44
  • I am getting error saying cannot connect to the destination server (Error code 110). mysqldbcopy allows to copy database locally without limitation. Maybe the source of Your problem is no multi-logon allowed? Try to create separate users for source and destination connections... – Akina May 24 '18 at 16:04
  • 13.67.59.xxx is external host? If so, remember, all of data will be copied via Your workstation... if Db size is large, it may cause some problems, and in any case will take a long time. Maybe server-local copy process is more safe? – Akina May 24 '18 at 16:08
1

do dump of your current database

mysqldump -p yourDatabase > file.sql

then create new database and restore file.sql

mysql -p -e "create database new_DB"

mysql -p new_DB < file.sql

| improve this answer | |
0

Same database just on different schema names? Try this:

CREATE DATABASE new_db; CREATE TABLE new_db.tbl_name AS SELECT * FROM old_db.tbl_name;

If you have a bunch of tables in there you can just create a script to do the job.

| improve this answer | |
  • I have so many functions, procs triggers and all. So cannot work out like that. – Nikesh Kedlaya Oct 21 '16 at 9:19
  • what exact errors are you getting from mysqldbcopy? maybe you need to specify the socket file – jerichorivera Oct 21 '16 at 9:26
  • @Nikesh many functions, procs functions/procedures scope is server, not database. – Akina May 24 '18 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.