Knowledgebase Home / Managing databases via SSH command line

Managing databases via SSH command line

Managing databases via the SSH command line is sometimes necessary & can be faster than using the phpMyAdmin web interface. If you do not currently have SSH access on your hosting account, you will need to request it via our support department as we do not enable SSH by default for security reasons.

When using the -p flag, you will be prompted to enter the password for the username specified. This password will be the password specified when creating the database username through cPanel.

Exporting a mySQL database:

mysqldump -p -u username database_name > databasename.sql

Importing a mySQL database: 

mysql -p -u username database_name < databasefile.sql

Note: The database file (.sql extension) must be located on the server. We recommend uploading it to your /home/ directory and working from that directory. We do not recommend placing a database file into any publicly accessible directory.

An alternative to importing or exporting a database using ssh would be to use the phpMyAdmin web interface. If your database is rather large, you may find that using the ssh import/export options are better suited to perform the task.

As always, should you have any questions or problems, please feel free to submit a service ticket with our technical support department.

If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look.

Our Guiding Principles

  • Provide consistent, stable and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.