Home Database Mysql Tutorial 整库备份mysql_MySQL

整库备份mysql_MySQL

Jun 01, 2016 pm 01:51 PM
yes username

我们经常要对数据库做备份,库里面有好几个schema,挺麻烦的,写个脚本,嗯,方便

目前的用户名,密码,host都是写死在脚本里,这样比较方便,有需要的朋友可以把他改成读参数的,

或者是windows风格的下一步

#!/bin/basht=`date +%Y%m%d_%H%M`p_user=rootp_pwd=123456p_host=127.0.0.1#从数据库中读出表结构echo 'select  SCHEMA_NAME  from SCHEMATA ' > sql#p_all_db=(gzcore gzchar gzrealmd gzshop)p_all_db=(`mysql -h${p_host} -u${p_user} -p${p_pwd} information_schema < sql`)rm sql#如果文件夹存在则删除#[[ -d ${p_host} ]] || rm -rf ${p_host}#创建新文件夹mkdir ${p_host} 2>/dev/nullcd ${p_host}#生成for i in ${p_all_db[*]}do    if [ "SCHEMA_NAME" = $i ] || [ "information_schema" = $i ] || [ "mysql" = $i ];then    echo "skip ${p_host} $i"     continue  else    echo "bak ${p_host} $i .."    rm -f ${PWD}/${i}_${t}.dump 2>/dev/null    mysqldump -u${p_user} -p${p_pwd} -h${p_host} --databases $i > ${PWD}/${i}_${t}.dump  fidone#返回原来的路径cd ..
Copy after login

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? Apr 11, 2024 am 09:10 AM

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

How to change your name on Instagram 14 days ago How to change your name on Instagram 14 days ago Apr 16, 2023 pm 02:40 PM

In the early days of social media, you could change your profile name multiple times, but now changing your name on any social media app comes with its own set of restrictions. If you've been wanting to change your display name or username on Instagram, the post below will explain how often you can change them, how to do it, and what you can do when you can't change your name on the platform . How to change display name and username on Instagram? Instagram offers two places for your name - your display name and your username, and luckily you can change both easily in the mobile app. The display name is what you would normally enter true

Fix: Issues with Oobekeyboard Ooberegion Oobelocal oobe settings issues on Windows 11/10 Fix: Issues with Oobekeyboard Ooberegion Oobelocal oobe settings issues on Windows 11/10 Apr 17, 2023 am 09:01 AM

OOBE or out-of-box experience is a process designed for users to guide them through the various stages of post-installation steps. This includes rights and agreement pages, login pages, WiFi or network connection options, etc. If you receive any OOBEKeyboard, OOBELOCAL, or OOBEREGION issues, you will not be able to proceed to the final installation steps. Don't worry. There are some simple fixes you can use to resolve this issue. Workarounds - Before you do anything else, try these normal solutions - 1. When you get an error prompt, go ahead and click on the "Try Again" prompt. Keep trying at least 7 to 8 more times. 2. Check network connectivity. If you are using an Ethernet connection or Wi-Fi

How to get your Steam ID in a few steps? How to get your Steam ID in a few steps? May 08, 2023 pm 11:43 PM

Nowadays, many Windows users who love games have entered the Steam client and can search, download and play any good games. However, many users' profiles may have the exact same name, making it difficult to find a profile or even link a Steam profile to other third-party accounts or join Steam forums to share content. The profile is assigned a unique 17-digit id, which remains the same and cannot be changed by the user at any time, whereas the username or custom URL can. Regardless, some users don't know their Steamid, and it's important to know this. If you don't know how to find your account's Steamid, don't panic. In this article

How to fill in the user name of Railway 12306 How to fill in the user name of Railway 12306 Feb 23, 2024 pm 04:07 PM

How to fill in the user name of Railway 12306? You can fill in the user name in Railway 12306 APP, but most friends don’t know how to fill in the user name of Railway 12306. Next is the graphic tutorial on how to fill in the user name of Railway 12306 brought by the editor. , interested users come and take a look! Railway 12306 usage tutorial How to fill in the Railway 12306 username 1. First open the Railway 12306 APP and click [Register] at the bottom of the main page; 2. Then on the registration function page, enter the user name, password, confirmation password, etc.; 3. Finally enter Once completed, you can fill in the user registration.

What is the wifi username? What is the wifi username? Mar 21, 2023 am 11:32 AM

The wifi username refers to the administrative username of the wireless router. This username, the IP address of the router, and the default administrative password are usually printed on the bottom of the wireless router and can also be found in the manual of the wireless router; the default administrative user of most routers The name is both admin, and the management password is also admin.

How to change Instagram username on Android phone How to change Instagram username on Android phone Apr 14, 2023 pm 07:31 PM

Instagram is one of the social media giants primarily based on photo and video sharing. People browse high-quality photos through apps, now using Instagram Reels and IGTV, with short and long videos. It has also become a big source of income for many people around the world through advertising and how they capitalize on their growing number of followers. The app is very addictive and you can spend hours just browsing the app. The Instagram app allows you to choose a new username and also a new name. The main difference between a name and a username is that a username is the title of your profile, while a name is a description of what your profile represents. Here, let’s see how to change your name using an Android phone.

How to change your Gmail account username on iPhone How to change your Gmail account username on iPhone Apr 13, 2023 pm 02:34 PM

Many users create their Gmail accounts when they are young and after a few years, they want to change their Gmail account username. Some people may want to change their username because they changed their name after marriage. Although, once you create your Gmail address, you can never change it, you can certainly change your Gmail account username. Some iPhone users are still unsure how to change their Gmail username. However, this article explains to you how to change Gmail account username on iPhone in simple steps. How to change your Gmail account username on iPhone Step 1: First open the Gmail app on your iPhone. Step 2: After opening the Gmail app

See all articles