![]() It means that we can easily create a backup of the database schema to create a similar database on another server. Using an option called -no-data, we can easily export database schema without any data in it. Similarly, you can even export Database schema without any data. $ mysqldump -uroot -p -databases databaseName exampleDatabase > backup123.sql > exportFile.sqlĪnd here is an example to export databaseName and exampleDatabase into a file backup123.sql. mysqldump -uUSERNAME -p -databases DATABASE1 DATABASE2. Here is the syntax to dump multiple databases in a file using mysqldump. This is useful if you have multiple databases for a single application. As the command will simply output the data and we can use the > operator to redirect the output into a file, we can even store the backup of multiple databases in a single file. With this tool, you can even export multiple databases in a single file. Now, Let’s see how to export specific databases with mysqldump. $ mysqldump -uUSERNAME -p -all-databases > exportFile.sql To export all the databases, execute the following command. In this case, the syntax is an example too. ![]() It is even easier to export all the databases. Now, Let’s see how we can export all the databases at once using this awesome tool! mysqldump all databases $ mysqldump -uroot -p test1 > test1Backup.sql mysqldump -u USERNAME -p DATABASE > exportFile.sqlįor instance, if you want to export a database called test1 into a file called test1Backup.sql, you can execute the following command. Here is the syntax to dump a single database into a file. It means that we can store the dump in SQL file and later use it to restore our database. The data that mysqldump spits out is in the SQL format. And we will store the dump into an SQL file. In this case, we just want to take a backup of a single MySQL database. ![]() So, Let’s get started with the most basic and simplest task, backing up a single database. We will see an example of each of the task along with the syntax that you can follow to perform the similar backup task. In this section of the guide, we will see how to perform some of the common tasks using this program. Now, Let’s learn how to perform some most common tasks using mysqldump backup program. Based on the command given above, the easier version of the syntax is as follows. Execute it and the utility will spit out the data in the command line as output. $ mysqldump -u root -p DATABASE_NAME TABLE_NAMEĭo not forget to replace username, database name and table name in the command. If you want to try out the utility without redirecting the output to a file, execute the following command. ![]() However, if you want to store it in a file, you have to use the > operator in Linux. The utility will only spit out the data as output as per your requirements. It means that mysqldump cannot create a file with all the data on its own. The reason is, > is an operator in Linux that tells the system to redirect/store the output in the filename given after > operator. ![]() Normally, in the mysqldump tutorials, you will see > example.sql at the end. According to the man page of mysqldump, the syntax of the command is as follows. So, Log in to your server via SSH or open up a terminal on your computer and let’s start with the syntax of the mysqldump command in Linux. It is a very good utility with lots of features to back up your data. With mysqldump, you can even take a backup of your database schema, data in specific tables, whole database or multiple databases. You will learn almost everything you need to learn in order to backup your data efficiently. In this guide, you will learn mysqldump utility in depth. MySQL provides a program/utility to backup your data. If you are using WordPress, you are using MySQL for database management. In most cases, you might be using MySQL Database management system to manage your database. For example, if you are a blogger, you don’t want to lose the content you wrote on your blog. And the information a database holds is very important for an individual or a company that owns the database. It does not matter if it is a web application or a mobile application. The Ultimate guide on mysqldump – A Database backup programĮvery application needs a database to store information. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |