Import all grant statement of users in mysql schema !
匯出所有使用者的grant sql語句:
mysql --default-character-set=utf8 -e "SELECT CONCAT('show grants for ''',USER,'''@''',HOST,''';') as gsql FROM mysql.user WHERE USER NOT IN('','root');" > g1.log;
sed -i '1d' g1.log
# sed 's/gsql//g' g1.log > g2.log;
> g3.sql;
sed -n '2,$p' g1.log|while read var
do
#cnt=(`mysql -N -s --default-character-set=utf8 -e "select count(*) from "$var`)
#echo $var
mysql --default-character-set=utf8 -e "$var" >> g3.sql;
done
sed 's/$/&;/g' g3.sql > g4.sql;
sed '/Grants for/d' g4.sql > g5.sql;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23490154/viewspace-1062535/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle users / 許可權 / grant privOracle
- Mysql8.0不支援grant all privileges on *.* to root@“%“ identified by “.“;MySqlIDE
- mysql grant 命令MySql
- MySQL Grant命令MySql
- Automatically Map Network Drives on Domain Login for All Users, Certain Users, or Certain GroupsAI
- MySQL Performance SchemaMySqlORM
- mysql export & importMySqlExportImport
- mysql import and exportMySqlImportExport
- save the status of schema and gather all stat of schemas again.AI
- MySQL 5.7 SYS SCHEMAMySql
- import_schema_stats時報出ORA-20000:Import
- mysql 給了使用者所有許可權ALL PRIVILEGES,但是該使用者沒有grant許可權MySql
- 追溯 MySQL Statement Cancellation TimerMySql
- Mysql Prepared statement needs to be re-preparedMySql
- MySQL Performance Schema詳解MySqlORM
- grant with admin/grant option
- MySQL 5.7 Performance Schema 介紹MySqlORM
- mysql 5.7中嶄新的 mysql sys schemaMySql
- Types of Oracle Database Users : Database Users (6)OracleDatabase
- MySQL:You must reset your password using ALTER USER statement before executing this statement.MySql
- Monitor All SQL Queries in MySQL (alias mysql profiler)MySql
- MYSQL中information_schema簡介MySqlORM
- mysql information_schema innodb_trxMySqlORM
- mysql5.5 performance_schema 初探MySqlORM
- mysql的mysql.event和information_schema.eventsMySqlORM
- Statement
- 【Mysql】mysql5.7新特性之-sys schema的作用MySql
- [MySql技術]MySQL中information_schema是什麼MySqlORM
- MySQL 進階:INFORMATION_SCHEMA 簡介MySqlORM
- MySQL5.6 PERFORMANCE_SCHEMA 說明MySqlORM
- MySQL中information_schema是什麼MySqlORM
- mysql performance schema 第2部分MySqlORM
- itpub網友問題--如何讓某資料庫使用者不能查詢all_users資料庫
- SQL__GRANTSQL
- Oracle default usersOracle
- #import vs @importImport
- MySQL information_schema 系統庫介紹MySqlORM
- MySQL調優效能監控之performance schemaMySqlORM