使用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 @   哈喽哈喽111111  阅读(184)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~
历史上的今天:
2021-11-24 Shell脚本中判断字符串是否被包含在内并且使用grep 精确匹配
2021-11-24 获取Docker容器名称和ID
2021-11-24 K8s deployments的故障排查可视化指南已更新(2021 中文版)
2021-11-24 shell分割字符串并赋值给变量
点击右上角即可分享
微信分享提示