mysql过滤information_schema|mysql|performance_schema导出 mysql -uroot -h 127.0.0.1 -ptest123123 -e 'show databases;'|grep -E -v "Database|information_schema|mysql|performance_schema" |xargs mysqldump -uroot -h 127.0.0.1 -ptest123123 --databases > 3.sql mysql过滤information_schema|mysql|performance_schema导出 #!/bin/bash i=`mysql -uroot -h 127.0.0.1 -ptest123123 -e 'show databases;'|grep -E -v "Database|information_schema|mysql|performance_schema"` for k in $i do mysqldump -uroot -h 127.0.0.1 -ptest123123 $k >> db.$k.sql done mysql过滤information_schema|mysql|performance_schema导入 i=`cat db.txt` for k in $i do mysql -uroot -h 127.0.0.1 -ptest123123 -e 'create database "$k";' mysql -u root -h 127.0.0.1 -ptest123123 $k < db.$k.sql done 创建库 create database 库名; 给权限 GRANT all ON *.* TO test111@'127.0.0.1' IDENTIFIED BY 'test123123'; GRANT all ON *.* TO root@'127.0.0.1' with grant option;
请登录之后再进行评论
登录