使用mysqldump 命令
1、导出数据和表结构
mysql -uroot -p zabbix >zabbix.sql #zabbix 数据库名
回车输入密码
2、只导出表结构
mysql -uroot -p -d zabbix >zabbix.sql #zabbix 数据库名
二、导入数据库
方法一:创建空数据库
create database zabbix character set utf8 collate utf8_bin; #创建数据库并设置字符集
use zabbix; #选择数据库
source /home/zabbix.sql; #导入数据库
方法二:mysql -uroot -p root < zabbix.sql
转载:
https://blog.csdn.net/linglongwunv/article/details/5212696?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165103762216781818774802%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=165103762216781818774802&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-1-5212696.142v9pc_search_result_cache,157v4control&utm_term=linux%E4%B8%AD%E5%B0%86mysql%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E8%8E%AB%E5%93%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%BC%E5%85%A5%E5%88%B0linux%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%AD&spm=1018.2226.3001.4187