Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using Command Line to back up MySQL Database in Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following brings you about the method of using the command line to back up the MySQL database in Linux. I believe you must have read similar articles. What's the difference between what we bring to everyone? Let's take a look at the body. I'm sure you'll get something after reading the method of using the command line to back up the MySQL database in Linux.

How to export a MySQL database using the command line in Debian or Ubuntu

The command to export the database in mysql using the command line is mysqldump. The mysqldump command should come with any installation of mysql or mariadb

The format to use it is as follows:

Mysqldump-u username-p database_name > output_file.sql

For example, if you have a mysql user name named "testuser" and a database named "sample_database", you can back up the mysql database "sample_database" using the following command.

Mysqldump-u testuser-p sample_database > output_file.sql

Note that I call the output sample_database_output.sql, but you can name it as you like. ) after entering the above command, you will be prompted for the user's MySQL password.

The following screenshot shows what the above command should look like:

An example of how to back up a mysql database in Debian or Ubuntu.

The output file will have SQL data, but you can actually name the file as needed, so the file extension does not have to end with .sql. It can end with .txt or any way you like.

You can see what the sample output SQL file should look like here. Through the link I mentioned, I output a database called mysql, which exists in every mysql installation.

Do you think it is what you want about the above method of using the command line to back up MySQL database in Linux? If you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report