shell读取mysql数据库两种方式
来源:互联网 发布:战地1狙击枪数据 编辑:程序博客网 时间:2024/05/19 03:47
mysql -hxxx -P3306 -uxxxx -pxxx test_bi -s -e \
"select m_ip,m_user,m_passwd,m_db,m_port,m_table,h_db,h_table,conditions from t_sqoop_task_info where is_valid=1 and task_id=67 limit 1" \
| while read m_ip m_user m_passwd m_db m_port m_table h_db h_table conditions
do
m_conditions=${conditions//'$'dt/`echo $time`}
echo ${m_ip}...${m_user}...${m_passwd}...${m_db}...${m_port}...${m_table}...${h_db}...${h_table}
read ct <<< $(echo `mysql -h$m_ip -P$m_port -u$m_user -p$m_passwd -D$m_db -s -e "select count(*) ct from $m_table where $m_conditions"`)
echo mysql -h$m_ip -P$m_port -u$m_user -p$m_passwd -D$m_db -s -e "select count(*) ct from $m_table where $m_conditions"
echo -e "${h_db}\t${h_table}\t${ct}" >> $data_path
done
"select m_ip,m_user,m_passwd,m_db,m_port,m_table,h_db,h_table,conditions from t_sqoop_task_info where is_valid=1 and task_id=67 limit 1" \
| while read m_ip m_user m_passwd m_db m_port m_table h_db h_table conditions
do
m_conditions=${conditions//'$'dt/`echo $time`}
echo ${m_ip}...${m_user}...${m_passwd}...${m_db}...${m_port}...${m_table}...${h_db}...${h_table}
read ct <<< $(echo `mysql -h$m_ip -P$m_port -u$m_user -p$m_passwd -D$m_db -s -e "select count(*) ct from $m_table where $m_conditions"`)
echo mysql -h$m_ip -P$m_port -u$m_user -p$m_passwd -D$m_db -s -e "select count(*) ct from $m_table where $m_conditions"
echo -e "${h_db}\t${h_table}\t${ct}" >> $data_path
done
阅读全文
0 0
- shell读取mysql数据库两种方式
- shell操作mysql数据库的两种方式
- 两种方式读取数据库显示。
- asp.net中读取数据库的两种方式
- asp.net中读取数据库的两种方式
- asp.net中读取数据库的两种方式
- asp.net读取数据库的两种方式
- asp.net中读取数据库的两种方式
- asp.net读取数据库的两种方式
- ListView两种读取数据库表的方式
- mysql下创建数据库的两种方式
- 连接MySQL数据库的两种方式介绍
- 讨论mysql和mysqli两种连接数据库方式
- php7连接mysql数据库的两种方式
- Spark读取数据库(Mysql)的四种方式讲解
- Spark读取数据库(Mysql)的四种方式讲解
- Spark读取数据库(Mysql)的四种方式讲解
- Spark读取数据库(Mysql)的四种方式讲解
- APP微信支付开发的流程
- JS获取2017-06-10格式的日期
- 异步标签与事件
- ffmpeg解码jpg并编码成h264
- Git常用的命令
- shell读取mysql数据库两种方式
- VirtualBox This kernel requires the following features not present on the CPU: 错误
- 统计同成绩学生人数 【HDU】-1235
- 等待事件标签
- 【Android Fragment】DialogFragment怎么玩?
- 异步转接标签
- centos7下ldap服务搭建
- 关于javascript的一些知识点
- 入门北京linux嵌入式培训行吗