cPanel Config

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

Importing/Exporting a mysql database

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Posted by yolau


Although you can do a database import and/or export from phpMyAdmin there is a size limitation (defined in my.cnf max_allowed_packet) when you do an import, so the only solution is to import it from shell.
This article will show you how simple it is to do it.

Importing a mysql database

  1. Login to your server as root or as a user that has access to that database
  2. Type the fallowing command
  3. mysql -uUSERNAME -pPASSWORD database_name < database.sql


Exporting a database

  1. Login to your server as root or as a user that has access to that database
  2. Type the fallowing command
  3. mysqldump -uUSERNAME -pPASSWORD database_name > database.sql

Notes:

USERNAME and PASSWORD is a combination that has access to that database. It can actually be the mysql root user.
database.sql is the file imported or the file to which you do the export.

Hope this helps !

Share this:
  • Digg
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • De.lirio.us
  • Furl
  • MyShare
  • Smarking
  • Technorati
  • YahooMyWeb

If you enjoyed this post, make sure you subscribe to my RSS feed!

One Response to “Importing/Exporting a mysql database”

  1. I moved from one host to another. I did a complete backup first and FTP’d to new host. All the files are there but my old username is in the database. How do I change that to my new user name without losing data? Both hosts use cPanel.

    I’ve heard of mysqldump but what is that and how do I get it and how do I use it?

    I need walking through with this. I am not a techie

Leave a Reply