Knowledgebase
Portal Home > Knowledgebase > How do i backup a Mysql database from command line?
How do i backup a Mysql database from command line?
| This article applies to those individuals with root level access to thier servers. If you do not have root level access, you will need to either request this from your host, or if Hyperactive is your Host, request this in a support ticket.
You may run into the problem where you cannot make a database backup using the tools we provide for you. The reason this may occur is that PHP is only allowed to run for a specific length of time, and if the Mysql Database dump takes to long, due to the size of the DB, it will fail. This happens frequently with the PHPMyAdmin tool, as it will not dump or import Databases over 2 megabytes in size.
Regardless, if you have root level access to your server, then please follow these steps to create a Database backup from command liine using Mysql command line utility.
1. Log into your Server Via SSH, Console or Terminal 2. Type: "mysqldump -uusername -p database_name > filename.sql" *Do Not Include The Quotes (")* 3. Hit Enter 4. Enter your password 5. Hit Enter
If all was successful you have now created a file called filename.sql which is a dump of the database called database_name. This file is a backup of your database, current as of the moment you made the dump. The sql file generated can be used at any time to restore your DB to the condition it was in as of the time the dump was created. That tutorial however, is in another article. Please search our knowledge base for "How do i Import or Restore my Mysql Database?
|
Add to Favourites
Print this Article
|