1.记录的导出和导入
注意目录权限
vim /etc/my.cnf
secure-file-priv=/backup mysql不信任该目录
chown mysql.mysql /backup mysql用户没有权限
select... into outfile 导出文本文件
systemctl restart mysqld
mysql -uroot -p'Qianfeng@123'
select * from haha.table1 into outfile '/backup/haha.table1.txt';
\q
ls /backup/
cat /backup/haha.table1.txt
mysql命令导出文本文件
mysql -uroot -p'Qianfeng@123' -e 'slelct * from haha.table1' > /backup/haha.table1.txt'
mysql -uroot -p'Qianfeng@123' --xml -e 'slelct * from haha.table1' > /backup/haha.table1.txt'
mysql -uroot -p'Qianfeng@123' --html -e 'slelct * from haha.table1' > /backup/index.html'
load data infile 导入文本文件
删除表内容
mysql -uroot -p'Qianfeng@123'
delete from haha.table1;
select * from haha.table1;
desc haha.table1;
load data infile '/backup/haha.table1.txt' into table haha.table1;