If the size of your tables is very big mysqldump can lock out users for a long period of time. The disadvantage is that the command locks tables. The advantages of using mysqldump are that it is simple to use and it takes care of table locking issues for you. The mysqldump command has advantages and disadvantages. add-locks: Adds the LOCK TABLES and UNLOCK TABLES statements you can see in the dump file. no-data: Dumps only the database structure, not the contents. add-drop-table: Tells MySQL to add a DROP TABLE statement before each CREATE TABLE in the dump. The mysqldump command has also some other useful options: $ mysqldump -u root -p -all-databases > alldb_backup.sql It tells MySQL to dump all the databases it has in storage. If you want to back up all the databases in the server at one time you should use the -all-databases option. $ mysqldump -u root -p -databases Tutorials Articles Comments > content_backup.sql Each database name has to be separated by space. In this case you can use the -database option followed by the list of databases you would like to backup. Sometimes it is necessary to back up more that one database at once. $ mysqldump -u root -p Tutorials php_tutorials asp_tutorials > tut_backup.sql Each table name has to be separated by space. For example, to back up only php_tutorials and asp_tutorials tables from the 'Tutorials' database accomplish the command below. With mysqldump command you can specify certain tables of your database you want to backup. This command will backup the 'Tutorials' database into a file called tut_backup.sql which will contain all the SQL statements needed to re-create the database. $ mysqldump -u root -p Tutorials > tut_backup.sql The filename for your database backupįor example, to backup a database named 'Tutorials' with the username 'root' and with no password to a file tut_backup.sql, you should accomplish this command: The password for your database (note there is no space between -p and the password) The dump file contains the SQL statements necessary to re-create the database. This command connects to the MySQL server and creates an SQL dump file. If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. You can also use this process to move your data to a new web server.īack up From the Command Line (using mysqldump)īack up your MySQL Database with Compressīacking Up and Restoring using PHPMyAdmin Back up From the Command Line (using mysqldump) This tutorial will show you two easy ways to backup and restore the data in your MySQL database. If you're storing anything in MySQL databases that you do not want to lose, it is very important to make regular backups of your data to protect it from loss.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |