In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Vim / data/mysqlback.sh
#! / bin/bash
BAKPATH=/data/mysql-back
MYUSER=root
MYPASS= "123456"
SOCKET=/var/lib/mysql/mysql.sock
MYCMD= "mysql-u$MYUSER-p$MYPASS-S $SOCKET"
MYDUMP= "mysqldump-u$MYUSER-p$MYPASS-S $SOCKET-x-B-F-R"
DBLIST= `$ MYCMD-e "show databases;" | sed "1D" | egrep-v "_ schema | test" `
[!-d $BAKPATH] & & mkdir-p $BAKPATH
For dbname in $DBLIST
Do
$MYDUMP $dbname | gzip > $BAKPATH/$ {dbname} _ $(date +% F) .sql.gz
Done
Execute the script to generate compressed files for the three libraries in the / data/mysql-back directory
The mysqldump command parameter description:
-lock-all-tables,-x
The submit request locks all tables in all databases to ensure data consistency. This is a global read lock and automatically turns off the-- single-transaction and-- lock-tables options.
-- databases,-B
Used to back up multiple databases, using this option, mysqldump treats each name as the database name. Without this option, mysqldump takes the first name parameter as the database name and the latter as the table name.
-- flush-logs,-F
Refresh the MySQL server log file before starting the dump. This option requires RELOAD permission. Note that if you use this option in combination with the-- all--database (or-A) option, the log is refreshed based on each dumped database.
Exception: when using-- lock-all-tables or-- master-data, in this case, the log is refreshed only once, after all tables are locked. If you want to dump and refresh the log at the same time, use-- flush-logs together with-- lock-all-tables or-- master-data.
-routines,-R
Dump stored programs (functions and programs) in the dumped database. The output produced with-routines contains CREATE PROCEDURE and CREATE FUNCTION statements to recreate the subroutine. However, these statements do not include properties, such as subroutine definers or create and modify timestamps. This means that when reloading subroutines, the definition of them should be set to the overloaded user when they are created, and the timestamp is equal to the overloaded time. If you need to create a subroutine that uses the original definer and timestamp attributes, do not use-- routines. Instead, dump and reload the contents of the mysql.proc table directly using a MySQL account with the appropriate permissions for the mysql database.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.