Importing/Exporting a mysql database
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
- Login to your server as root or as a user that has access to that database
- Type the fallowing command
mysql -uUSERNAME -pPASSWORD database_name < database.sql
Exporting a database
- Login to your server as root or as a user that has access to that database
- Type the fallowing command
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 !
If you enjoyed this post, make sure you subscribe to my RSS feed!
- November 5th


















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