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

How does Mysql perform a full backup

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to perform a full backup of Mysql". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Check what libraries are available on the

Mysql > show databases G

* * 1. Row *

Database: information_schema

* 2. Row * *

Database: mysql

* 3. Row * *

Database: test

3 rows in set (0.00 sec)

two。 Perform a full backup

Sh back.sh

Back.sh

#! / bin/sh

Export back_dir=/data/bak

Export pass= "123"

Export mysql_dir=/usr/local/mysql-5.1.56

For i in $(mysql-uroot-p$pass-e show databases G | grep Database | cut-d:-f2)

Do

$mysql_dir/bin/mysqldump-opt $I-p$pass-skip-lock-tables > $back_dir/$i.$ (date +% Y%m%d) .sql

Done

# use fetion to notice dba

LD_LIBRARY_PATH=/usr/lib / usr/local/fetion/fetion-mobile=159xxxx3240-pwd=123456-to=159xxxx3240-msg-utf8=mysql backup is success!

3. Schedule a task

Crontab-e

0 3 * sh / usr/bin/back.sh

This is the end of how Mysql performs a full backup. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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