How do I create or import a MySQL dump file?
Print Email
Email this article
Close
Email this article
CloseYou are here: Home > Website Support > MySQL
Creating a dump file of an existing MySQL database on the Hetzner server:
- Telnet or SSH to the hosting server
- Run the following command:
mysqldump --add-drop-table -Q -u[db username] -p
[db password] -h[db-host] [db name] > dumpfile.sql;
Eg.
mysqldump --add-drop-table -Q -udatabase_1 -ppassword_1 -hsql4a.your-server.co.za database1 > database_dump.sql
Replace the names between [ ] with your server/database name.
Importing a dump file to the Hetzner server to create the data structure/data:
- FTP your dump file to the home directory or your web hosting package
- Telnet or SSH to the hosting server
- Run the following command from the same directory:
mysql -u[dbusername] -p
[dbpassword] -h[dbhostname] [databasename] < dumpfile.sql;
Eg.
mysql -udatabase_1 -ppassword_1 -hsql4a.your-server.co.za database1 < database_dump.sql
Replace the names between [ ] with your server/database name.
Creating a dump file of less than 5MB to your Hetzner server via phpMyAdmin:
- Click on the PHPMyAdmin link next to the database in KonsoleH
- Once the PHPMyAdmin interface has loaded click on the ‘Export’ Tab at the top.
- If you do not have any specific requirements for the dump file you can just hit “GO” at the bottom of the page.
- Choose a location on your PC to save the dump file.
Importing a dump file of less than 5MB to your Hetzner server via phpMyAdmin:
- Select the ‘SQL’ query window from the top left hand corner within ‘phpMyAdmin’, this will open a separate pane
- Select ‘Import Files’
- Click on ‘Browse’ to find the dump file located in your local directory
- Click ‘Open’ to select the dump file
- Then click on ‘Go’ to begin the upload of the dump file to the server
You can download phpmyadmin to your local PC and manage your database there, if the limitation of 5MB is too restrictive. This requires you to have PHP, a webserver and Mysql installed locally.
Additional Resources (external links):
MySQL home page (http://www.mysql.com)
MySQL tutorials (http://www.devshed.com/c/b/MySQL)
Was this information helpful?
Yes NoThank you for your feedback
We are delighted to find that our article resolved your query.
Thank you for your feedback
We will resolve your query as soon as possible.
Please take a few moments to comment on your unresolved query. Simply tell us what your problem is. We guarantee that we'll get back to you within two hours (during office hours) in response to your query.
