1

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

mysqldbcopy --source=root:[email protected] --destination=root:[email protected] 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.

4
  • 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 Commented Oct 21, 2016 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 K. N.
    Commented May 26, 2017 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
    Commented May 24, 2018 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
    Commented May 24, 2018 at 16:08

2 Answers 2

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

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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