Solved

MOVE/COPY entire MySQL database

Posted on 2008-10-02
5
909 Views
Last Modified: 2008-11-07
Is there a way to move or copy an entire database, rather than just a table?
This would be across Cpanel hosting accounts, i have root access and MySQL access enabled.
I have myphpadmin and phpflashmyadmin

In myphpadmin, there's a database copy (structure+data) but i don't see how to copy it to another account.
For instance in the text field entry for    Copy database to:
i would want to put     newusername_dbname
but i get access denied.  So that means i need to login somehow as root.
I can login as root in phpflashmyadmin(there's no copy database option), but i don't know how to login as root  in phpmyadmin  since it's launched from a given cpanel hosting account

i may just need to export and  then import in the new account.
just seeing if there's a shortcut

thanks
0
Comment
Question by:willsherwood
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
mattaob earned 500 total points
ID: 22623694
You can use mysqldump from the command line

mysqldump -u username -ppassword -h source_server_ip   database_name  >   outputfile.sql

That will dump the database to a file

then
create the database in the mysql target server  

mysql -u username -ppassword -h target_server_ip  database_name <   outputfile.sql

0
 

Author Comment

by:willsherwood
ID: 22623739
i understand that that involves the strategy of exporting,  i was hoping there was a
copy-database    strategy available.
0
 
LVL 7

Expert Comment

by:mattaob
ID: 22623971
The mysqldump was is essentially making a backup of the database then restoring it to another server.
It's the way I prefer to do it as I've never lost any data doing it that way.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now