参考:MYSQL备份数据库表:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
[root@Mysql ~]# /usr/local/mysql/bin/mysqldump -uroot -p'admin' mysql user >/backup/user-tables-$(date +%F).sql [root@Mysql ~]# /usr/local/mysql/bin/mysqldump -uroot -p'admin' mysql servers user>/backup/servers-user-tables-$(date +%F).sql [root@Mysql ~]# egrep -v "^$|^--|\*" /backup/servers-user-tables-2014-06-05.sql DROP TABLE IF EXISTS `servers`; CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL DEFAULT '', `Host` char(64) NOT NULL DEFAULT '', `Db` char(64) NOT NULL DEFAULT '', ############################省略############################ `Owner` char(64) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'; LOCK TABLES `servers` WRITE; UNLOCK TABLES; DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', ############################省略############################ `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0', `plugin` char(64) COLLATE utf8_bin DEFAULT '', `authentication_string` text COLLATE utf8_bin, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'; LOCK TABLES `user` WRITE; UNLOCK TABLES; [root@Mysql ~]# |
申明:本文由BYRD原创(基于Mysql5.6.16),未经许可禁止转载! SourceByrd's Weblog-https://note.t4x.org/database/backup-more-tables/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!