【问题标题】:how to run mysql command with nohup如何使用 nohup 运行 mysql 命令
【发布时间】:2022-01-16 21:05:09
【问题描述】:

有人可以帮助我使用 nohup 运行此查询,我该怎么做? 使用以下命令,我遇到了错误

nohup mysql -u -p -A tablename " select distinct t2.white, t1.red from table t1 inner join temp t2 on t1.Data=t2.white INTO OUTFILE '/tmp/test.csv'   LINES TERMINATED BY '\n';" &

【问题讨论】:

  • 有什么理由不与我们分享确切的错误信息?
  • 错误信息如下:nohup: ignoring input and redirecting stderr to stdout

标签: mysql linux bash scripting


【解决方案1】:

请尝试

nohup mysql -u -p -A tablename " select distinct t2.white, t1.red from table t1 inner join temp t2 on t1.Data=t2.white INTO OUTFILE '/tmp/test.csv'   LINES TERMINATED BY '\n';" 2>&1 &

【讨论】:

  • 它不起作用。 :( 运行此命令后同样的错误并退出
  • mysql -u -p -A 数据库名。不是表名
  • 'mysql -u -p -A databasename -e " 选择不同的 t2.IM, t1.MS from Req t1 inner join temp t2 on t1.Data=t2.IM;" &>> /tmp/MS.csv & 否认'
  • 我试过了,但还是不行。
【解决方案2】:

nohup 命令后不添加重定向输出时,默认打印“nohup: ignoring inpu...”,然后退出。实际的命令已经在后台运行。

可以使用增加重定向命令,nohup不会输出ignorein错误。

nohup xxx> /tmp/nohup.log & 

你应该检查你的sql文件是否生成;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-15
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 2012-12-18
    • 1970-01-01
    • 2010-11-06
    相关资源
    最近更新 更多