Home > Database > Mysql Tutorial > MySQL 5.5权限导出脚本_MySQL

MySQL 5.5权限导出脚本_MySQL

WBOY
Release: 2016-06-01 13:34:12
Original
891 people have browsed it

bitsCN.com

MySQL 5.5权限导出脚本

 

[plain]

#!/bin/sh  

  

base_dir='/opt/soft/mysql'  

mysql_user='root'  

mysql_pwd='123456'  

mysql_socket='/tmp/mysql.sock'  

msyql_grants='/tmp/mysql_grants.sql'  

  

result=`${base_dir}/bin/mysql -u${mysql_user} -p${mysql_pwd} -S${mysql_socket} -N -e "select CONCAT('show grants for /'',user,'/'@/'',host,'/';') from mysql.user"`  

#echo ${result}  

${base_dir}/bin/mysql -u${mysql_user} -p${mysql_pwd} -S${mysql_socket} -N -e "${result}" > ${msyql_grants}  

  

sed -i "s/$/;/g" ${msyql_grants}  

  

cat ${msyql_grants}  

  

rm -f ${msyql_grants}  

 

bitsCN.com
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template