删除数据库所有表:
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') FROM information_schema.tables WHERE table_schema = '数据库名称';
备份数据库信息:
mysqldump -hhost -uroot -p'密码' 数据库名称 > 保存路径/备份名称.sql
如果报错:
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.
像如下执行:
mysqldump -hlocalhost -P3306 -uroot -p yl_xinao --set-gtid-purged=off > /data/www/xinao/xinao_zhengshi.sql