Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MOVE/COPY entire MySQL database

Posted on 2008-10-02
5
913 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 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