Just Host Web Hosting Help
MySQL Import and Export (.sql file) via SSH
Summary
This tutorial outlines the steps for importing and exporting MySQL databases via command line (SSH). Click Here for information about getting SSH access.
Export A MySQL Database
- Using SSH, execute the following command:
mysqldump -p -u username database_name > dbname.sql - You will be prompted for a password, type in the password for the username and press Enter. Replace username, password and database_name with your MySQL username, password and database name.
The file dbname.sql now holds a backup of your database and is ready for download to your computer.
Import A MySQL Database
- Start by uploading the .sql file onto the Just Host server
- If you haven't already done so, create the MySQL database via the cpanel. Click Here for further instructions
- Using SSH, navigate to the directory where your .sql file is.
- Next run this command:
mysql -p -u username database_name < file.sql
Note: The -p will prompt for your account's password.
Note: username is the user with rights to the database. If you are unsure what the username is you can use the same username and password used to sign into SSH.
Note: Make sure your database name has your Just Host username prefix with the _ (underscore) after it and the database name.
Knowledgebase Article
254,941 views
bookmark
share
tags: database mysql
(updated 266 days ago)
254,941 views
bookmark
share
Share or save this via:
tags: database mysql
(updated 266 days ago)
Recommended Help Content
How do I import a database using command line? (SSH) (updated 397 days ago)
I need to Export or Import a MySQL database (updated 1396 days ago)
An exported .sql file shows as a different size than the reported size in cPanel (updated 802 days ago)
Related Help Content
How do I import a backup of my database (.sql file) using phpMyAdmin? (updated 215 days ago)
How to export your database in phpMyAdmin.. (updated 216 days ago)
If you have a WordPress blog hosted on wordpress.com, you can easily export it and import it to WordPress that is installed on your hosting account with justhost. Login to the WordPress D (updated 650 days ago)
How do I make my MySQL database compatible with the version you provide? (updated 1412 days ago)
How to Restore your MySQL Database? (updated 404 days ago)
How do I create a MySQL backup? (updated 92 days ago)
Site Backup & Restore tool displays unexpected dates. (updated 802 days ago)
This article will explain MySQL database and user creation and deletion, and explain how to assign a user to a database. (updated 203 days ago)
E-mail
Twitter
Google Bookmarks
Facebook
MySpace
Digg
Reddit
Delicious
LinkedIn
StumbleUpon