gpt4 book ai didi

mysql - 如何从mysql中的文件运行查询

转载 作者:行者123 更新时间:2023-11-29 05:06:23 24 4
gpt4 key购买 nike

如何运行写入文件的 mysql 查询(只是他的查询部分),例如。账户.txt

/test/mysql -h testdb.com -P 8995 -p -u testaccount -e 
"select distinct
amp.account_id
from
account_marketplace_groups amp;" -D company > /tmp/output.csv

我怎样才能把实际的查询放在一个文件中并执行上面的操作并且仍然在 csv 中得到输出

这是正确的方法吗?

/test/mysql -h testdb.com -P 8995 -p -u testaccount -e /account.txt  -D company > /tmp/output.csv

最佳答案

-e 选项不能与文件名一起使用,它希望参数是查询。只需使用输入重定向,因为 mysql 从标准输入读取。

/test/mysql -h testdb.com -P 8995 -p -u testaccount  -D company < /account.txt > /tmp/output.csv

关于mysql - 如何从mysql中的文件运行查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47163811/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com