Solved

MOVE/COPY entire MySQL database

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WordPress AWS: site goes down 2 78
MySQL 11 69
MySQL ERROR 1045 (28000) 2 41
MySQL left join performance 4 14
Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

19 Experts available now in Live!

Get 1:1 Help Now