Clone user / Dump views in MySQL
1. 数据库搬迁或复制的时候,需要同步MySQL user 及其权限,创建了脚本操作,如下:
#!/bin/bash -l if [ $# -lt 1 ]; then echo "usage: $0 [MySQLHost]" exit 1 fi MySQLHost=${1} MySQLbin="`which mysql`" if [ ! -f "${MySQLbin}" ]; then MySQLbin="/usr/local/mysql/bin/mysql" fi if [ ! -f "${MySQLbin}" ]; then echo "can't find the mysql command,please check" exit 1 fi echo "SELECT DISTINCT CONCAT (\"show grants for '\", user, \"'@'\", host, \"';\") AS query FROM mysql.user where user not in ('root','mysql') and trim(ifnull(user,''))!=''; " > script.sql read -s -p "Enter the mysql password: " if [ "$REPLY" == "" ]; then echo "no password typed, the program will exit" exit 1 fi "${MySQLbin}" -h"${MySQLHost}" -umysql -p"${REPLY}" < script.sql > output.sql ; cat output.sql | grep show > output1.sql ; rm output.sql -f ; output_file="grants_for_mysql_account_on_${1}.sql" "${MySQLbin}" -h"${MySQLHost}" -umysql -p"${REPLY}" < output1.sql > ${output_file} ; clear echo "-----Exported Grants-----" sed -i 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' "${output_file}" cat "${output_file}" ; rm output1.sql -f echo "-------------------------" echo "generated ${output_file}" rm script.sql -f
2. 有时候,只需要备份或导出并搬迁一个数据库的所有 View,
可用命令如下:
mysql INFORMATION_SCHEMA --skip-column-names --batch -e "select table_name from tables where table_type = 'VIEW' and table_schema = 'db'" | xargs mysqldump db > /tmp/views_db.sql
相关推荐
mkdir /home/theuser/Templatious-Clone cd /home/theuser/Templatious-Clone git clone https://github.com/davidkazlauskas/templatious.git 然后,在您最喜欢的C ++构建系统上,添加include目录(例如cmake) ...
# (downloads the default branch of user/repo from GitHub) $ npx gitget user/repo # clone to /folder $ npx gitget user/repo folder # clone subfolder to /folder $ npx gitget user/repo/subfolder folder #...
快速开始(1)克隆仿真及其依赖项: git clone https://github.com/phetsims/assert.gitgit clone https://github.com/phetsims/axon.gitgit clone https://github.com/phetsims/babel.gitgit clone ...
彻底解决Mac端git clone/push速度太慢的问题,详情请参阅文档。
mysql-colorize mysql的着色安装重击例如,将存储~/.bash/mysql-colorize到~/.bash/mysql-colorize git clone https://github.com/horosgrisa/mysql-colorize.bash ~ /.bash/mysql-colorize 之后是mysql-colorize....
git clone git://git.ffmpeg.org/rtmpdump That will get you the very latest code. If you're looking for a specific older release you can look under: svn://svn.mplayerhq.hu/rtmpdump/tags The latest ...
torch 项目完整代码,公司无法使用git,所以放了个备份在csdn上 (git clone https://github.com/torch/distro.git ~/torch --recursive)
安装git clone git://github.com/kamipo/mysql-build.git ~/mysql-buildexport PATH="$HOME/mysql-build/bin:$PATH"用法mkdir -p ~/opt/mysqlmysql-build -v 5.7.10 ~/opt/mysql/mysql-5.7.10cd ~/opt/mysql/mysql-...
Clone Detection in Secure Messaging- Improving Post-Compromise Security in Practice
从您的命令行: # Clone this repository$ git clone https://github.com/matheuscastroweb/tiktok-clonetiktok-clone# Go into the repository$ cd tiktok-clone# Install dependencies$ yarn install# Run
使用在linux操作系统上使用git clone下载github上模型速度慢,多数是因为网不好。 提供了两种方法,可以同时使用。 方法:先刷hosts 1. 命令行输入下列代码,找到 github.global.ssl.fastly.Net对应的Address,记录 ...
tdriver git clone的文件,具体文件如下: git clone git://gitorious.org/tdriver/driver.git git clone git://gitorious.org/tdriver/sut_qt.git git clone git://gitorious.org/tdriver/agent_qt.git git clone ...
假设三节点MGR某个节点异常,需要重新把这个节点加入到MGR集群中,具体操作过程如下: 贡献者端执行(192.168.1.11) DROP USER 'donor_clone_user'@'...INSTALL PLUGIN clone SONAME 'mysql_clone.so'; 接收者端执
Caffe2 Windows third_party(git clone失败或速度慢时可用)
本科毕业设计+python+基于Flask+Bootstrap+Mysql的项目审批系统(含源码+数据库) 安装相关库 $ git clone https://github.com/rmboot/approvalsystem $ cd approvalsystem $ pipenv install $ pipenv shell 初始化...
Facebook界面克隆 ... :check_mark: 关于该项目 尽可能忠实的界面(仅删除广告和相关内容),完全组成并且具有干净且健壮的代码。 :electric_plug: 要求... // In the terminal, run to start the project $ yarn dev | |
mysql8.0之后自带的物理备份插件clone
git-clone-init:在git clone上自动设置用户身份(user.email user.name)
-- your website rootgit clone https://github.com/luzeagithub/techbench-dump-web.git .wget https://techbench.luzea.ovh/dump.json您可以使用上方的链接下载定期更新的转储文件,也可以使用自己生成更新。贡献...
User Guide for Clone Deployment WinS2003 based APG40 C 4