#!bin/bash
Query="update table_name set colume ='i' where column_name is NOT NUll"
mysql -u username -p password mysql <<EOF
$query;
EOF
Run Code Online (Sandbox Code Playgroud)
上面的脚本不起作用
Mysql 文档非常干净:
#!bin/bash
query="update table_name set colume ='i' where column_name is NOT NUll"
mysql -u username -p password mysql -e "$query";
Run Code Online (Sandbox Code Playgroud)
-e
选项允许向 mysql 服务器发送任意查询。