Mysql – Create a copy of the database in same server

MySQL

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.

Best Answer

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