MySQL Workbench - 如何诊断查询失败问题

时间:2022-10-13 13:04:58

I have loaded MySQL and MySQL workbench on my PC, and am using it to build up my SQL skills, accessing only data stored on and served by the PC itself.

我已经在我的PC上加载了MySQL和MySQL工作台,并且正在使用它来建立我的SQL技能,只访问存储在PC本身并由PC本身提供的数据。

When a query fails the only message I get is one telling me it failed because of an error.

当查询失败时,我得到的唯一消息是告诉我由于错误而失败。

Is there any way to get more helpful information about what problem the software detected that caused it to raise the error message?

是否有任何方法可以获得有关软件检测到哪些问题导致其引发错误消息的更多有用信息?

I am using WorkBench 6.0 on linux mint Rebecca. I am also using it on the same PC (dual-boot) on windows 7, although I don't know the windows WorkBench version right now because I'm writing this from linux. In both cases no info is provided about why the query failed. In WorkBench 6.0 on linux all I get is a 'Query Interrupted' message. On windows I just get a white cross on a red circle telling me there's an error and that I need to correct my code.

我在linux mint Rebecca上使用WorkBench 6.0。我也在Windows 7上的同一台PC(双启动)上使用它,虽然我现在不知道Windows WorkBench版本,因为我是从linux编写的。在这两种情况下,都没有提供有关查询失败原因的信息。在Linux上的WorkBench 6.0中,我得到的是“查询中断”消息。在Windows上我只是在一个红色圆圈上得到一个白色十字架,告诉我有一个错误,我需要更正我的代码。

If the best solution is to use something other than WorkBench I'm quite open to that. I'm starting to wonder whether WorkBench is not the best tool for this type of activity aimed at developing sql query skills. The docn spends a lot of time talking about forward and reverse engineering and models, and I think I've got the general idea of what that is, but all I want to do is read in tables from csv files, manipulate and analyse them, then write out some result tables. I wanted a GUI that would also let me browse the tables, and highlight syntax errors in the code editing window, and thought that WorkBench would be the tool to do that, but it looks like it might be aimed at doing much more than that, and may be an unnecessarily complex environment for what I'm trying to do.

如果最好的解决方案是使用除WorkBench以外的其他东西,我对此非常开放。我开始怀疑WorkBench是否不是这类旨在开发SQL查询技能的活动的最佳工具。 docn花了很多时间谈论正向和反向工程和模型,我想我已经对这是什么有了一般的想法,但我想做的就是从csv文件的表中读取,操作和分析它们,然后写出一些结果表。我想要一个GUI,它也可以让我浏览表格,并在代码编辑窗口中突出显示语法错误,并认为WorkBench将是这样做的工具,但看起来它可能旨在做更多的事情,对于我正在尝试做的事情,这可能是一个不必要的复杂环境。

Thank you

谢谢

1 个解决方案

#1


25  

D'oh. I realise the problem was just that the Output Area was not visible on my WorkBench screen. For some reason when I first loaded it, the Output area was condensed down to just a heading, with no room to see the lines describing the result of each statement, and error codes when applicable.

D'哦。我意识到问题只是输出区域在我的WorkBench屏幕上不可见。出于某种原因,当我第一次加载它时,输出区域被压缩到一个标题,没有空间看到描述每个语句结果的行,以及适用时的错误代码。

One first needs to check that the Output Area is not deliberately hidden, by doing menu actions: View > Panels > and looking whether it says Hide Output Area or Show Output Area. If it says the former then the area is currently hidden, so one needs to click the 'Show Output Area' option and it will appear.

首先需要通过菜单操作检查输出区域是否被故意隐藏:查看>面板>并查看是否显示隐藏输出区域或显示输出区域。如果它说前者,那么该区域当前是隐藏的,因此需要单击“显示输出区域”选项,它将出现。

The Output Area appears at the bottom right of the WorkBench screen. If statement results do not appear, one needs to get the horizontal divider at the top of the Output Area and drag it up so there's enough space to see the error codes.

输出区域显示在WorkBench屏幕的右下角。如果没有出现语句结果,则需要在输出区域的顶部获取水平分隔符并将其向上拖动,以便有足够的空间来查看错误代码。

Once the error codes are visible, one can sometimes fix the problem from the attached explanation alone. If not, the error code can be looked up to get more info about what's wrong. Thank to Lucas for pointing that out!

一旦错误代码可见,有时可以单独从附加的解释中解决问题。如果没有,可以查找错误代码以获得有关错误的更多信息。感谢Lucas指出这一点!

#1


25  

D'oh. I realise the problem was just that the Output Area was not visible on my WorkBench screen. For some reason when I first loaded it, the Output area was condensed down to just a heading, with no room to see the lines describing the result of each statement, and error codes when applicable.

D'哦。我意识到问题只是输出区域在我的WorkBench屏幕上不可见。出于某种原因,当我第一次加载它时,输出区域被压缩到一个标题,没有空间看到描述每个语句结果的行,以及适用时的错误代码。

One first needs to check that the Output Area is not deliberately hidden, by doing menu actions: View > Panels > and looking whether it says Hide Output Area or Show Output Area. If it says the former then the area is currently hidden, so one needs to click the 'Show Output Area' option and it will appear.

首先需要通过菜单操作检查输出区域是否被故意隐藏:查看>面板>并查看是否显示隐藏输出区域或显示输出区域。如果它说前者,那么该区域当前是隐藏的,因此需要单击“显示输出区域”选项,它将出现。

The Output Area appears at the bottom right of the WorkBench screen. If statement results do not appear, one needs to get the horizontal divider at the top of the Output Area and drag it up so there's enough space to see the error codes.

输出区域显示在WorkBench屏幕的右下角。如果没有出现语句结果,则需要在输出区域的顶部获取水平分隔符并将其向上拖动,以便有足够的空间来查看错误代码。

Once the error codes are visible, one can sometimes fix the problem from the attached explanation alone. If not, the error code can be looked up to get more info about what's wrong. Thank to Lucas for pointing that out!

一旦错误代码可见,有时可以单独从附加的解释中解决问题。如果没有,可以查找错误代码以获得有关错误的更多信息。感谢Lucas指出这一点!