In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to back up the database under Linux, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
During the development of the project, the backup of the database is very important, because the database is easy to be accidentally deleted, resulting in inestimable losses, so it is necessary to back up the database.
I. MySQL database backup
As shown in the figure: there are 6 databases in this system, and we take test as an example to demonstrate. Database backup instruction: mysqldump-u root-p test > / home/lzh/bak/test.sql where test represents the name of the database we want to back up, and'/ home/lzh/bak/test.sql' represents the path we want to store
When we enter the backup instructions, we are asked to enter the login password, and the database backup is completed after entering the password. At this point, we have backed up the database test to test.sql in the home/lzh/bak directory. Add-B parameter backup We add-B parameter when backing up the database, the backup file will have more statements to create the library than without-B. The instructions are as follows: mysqldump-B-u root-p test > / home/lzh/bak/2019-03-04/test.sql we also need to enter the login password for the database. Specify the compression command gzip compress backup stumysql1 database instructions as follows: mysqldump-B-u root-p test | gzip > / home/lzh/mysql_bak_B.sql.gz
❝
Note: add pipes before compressing commands.
II. Restore of the database
Mysql command restore instructions are as follows: mysql-u root-p test use the source command to restore the database the first step: enter the mysql console, switch to the database we want to restore data, instructions such as: use database name second step: use the source command to restore, that is, we back up the .sql file, instructions such as: source / home/lzh/bak/test.sql decompression package to restore data gzip-d / home/mysql_bak_B.sql.gz.
The above is all the contents of the article "how to back up the database under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.