How to Back Up MySQL Databases From The Command Line

How to Back Up MySQL Databases From The Command Line - Hi sobat!! customgadget, Pada sharing customgadget kali ini tentang How to Back Up MySQL Databases From The Command Line, disini kami menyediakan review serta Gameplay sebaik mungkin agar bisa memberikan gambaran tentang artikel tersebut,semoga bermanfaat.

Post Title : How to Back Up MySQL Databases From The Command Line
Post Title : How to Back Up MySQL Databases From The Command Line

lihat juga


How to Back Up MySQL Databases From The Command Line

While automated backups are important, sometimes you just want to take a quick and dirty snapshot before making a change to your data. When changing files in Linux, you can simply cp a file to another name, and cp it back if your change does not workout. With MySQL, it is not quite that simple, but it is by no means difficult.

How to Back Up MySQL Databases From The Command Line

Creating A Backup

The mysqldump command is used to create textfile “dumps” of databases managed by MySQL. These dumps are just files with all the SQL commands needed to recreate the database from scratch. The process is quick and easy.
If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time:
mysqldump --databases database_one database_two > two_databases.sql
In the code above, database_one is the name of the first database to be backed up, and database_twois the name of the second.
It is also simple to back up all of the databases on a server:
mysqldump --all-databases > all_databases.sql
Restoring a Backup
Since the dump files are just SQL commands, you can restore the database backup by telling mysql to run the commands in it and put the data into the proper database.
mysql database_name < database_name.sql
In the code above, database_name is the name of the database you want to restore, and database_name.sql is the name of the backup file to be restored..
If you are trying to restore a single database from dump of all the databases, you have to let mysql know like this:
mysql --one-database database_name < all_databases.sql

Restoring Databases From cPanel Backups

There is no special wisdom to pass on to you regarding restoring databases from cPanel backups. If you do not wish to use cPanel's automatic methods of restoring entire accounts, you can open up the individual backup on the command line, find the mysql dump file you wish to restore, and use the above commands to perform the restore.



Demikianlah Artikel How to Back Up MySQL Databases From The Command Line

Sekian customgadget How to Back Up MySQL Databases From The Command Line, mudah-mudahan bisa memberi manfaat untuk anda semua.

Anda sedang membaca artikel How to Back Up MySQL Databases From The Command Line dan artikel ini url permalinknya adalah https://customgadgets.blogspot.com/2018/03/how-to-back-up-mysql-databases-from.html Semoga artikel ini bisa bermanfaat.

0 Response to "How to Back Up MySQL Databases From The Command Line"

Post a Comment

Popular Posts

Total Pageviews