我在终端中执行MySQL命令时遇到错误1054(42S22) [英] Getting ERROR 1054 (42S22) while i am executing the MySQL command in the Terminal

查看:546
本文介绍了我在终端中执行MySQL命令时遇到错误1054(42S22)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从status='RECEIVED'表中的status='RECEIVED'收集数据,并且要将这些数据存储在文件中.
当我尝试在终端中执行此操作时,我会得到ERROR 1054 (42S22).

I want to collect the data from the crawlstatus table where status='RECEIVED' and I want to store that data in an file.
When I am trying to do this in the terminal I am getting ERROR 1054 (42S22).

这是我用来获取数据的命令:

Here is the command that which i used to get the data:

sudo sh -c '/usr/local/mysql/bin/mysql -h localhost -P 3306 --user=root --password=XXXXXXXXXX -e "select count(*) from crawlstatus where status='RECEIVED';" test_navin > size.log'

我收到以下错误:

ERROR 1054 (42S22) at line 1: Unknown column 'RECEIVED' in 'where clause'

任何人都可以帮助我解决这个问题

Can anyone help me in solving this problem

推荐答案

在这里,您将查询作为参数传递,因此请使用'包装查询,但请确保添加转义序列以使用'包装查询

Here, you are passing your query as an argument so wrap query with', but make sure that you add escape sequence to wrap query with'

您应该使用"包装列值.

sudo sh -c '/usr/local/mysql/bin/mysql -h localhost -P 3306 --user=root --password=XXXXXXXXXX -e "select count(*) from crawlstatus where status=\"802350570V\";" test_navin > size.log'

这篇关于我在终端中执行MySQL命令时遇到错误1054(42S22)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆