使用shell脚本从MySQL中导入导出数据

#!/bin/bash

echo "
set names utf8;
use mall_test;

select phone,gender from unimall_user where id<=120466;

"|mysql -h8.142.4.65 -uliyongtao -pety%8W%BunLRwV!k > test.txt

echo "
set names utf8;
use mall_test;

load data local infile 'test.txt' ignore into table
test_ce ignore 1 lines (user_name,sex);
"|mysql -h8.142.4.65 -uliyongtao -pety%8W%BunLRwV!k

posted @ 2023-11-24 13:39  哈喽哈喽111111  阅读(174)  评论(0编辑  收藏  举报