PHPMyadmin 不显示 mysql 错误消息

2022-01-05 00:00:00 syntax-error php mysql phpmyadmin

我在我的网站上安装了 phpMyAdmin 并且它工作正常.但是当我输入错误时,它不会显示 mysql 错误消息,只显示错误代码.

I installed phpMyAdmin on my site and it works. But when I mistype a query it does not show the mysql error message only the error code.

1064 -

我期待以下内容:

1064 - 你在你的废话中犯了错误......

1064 - You have and error in your blah blah...

如果没有错误消息,就很难知道哪里出了问题.

Without an error message it's difficult to know what's wrong.

在我的 php 脚本中,我可以通过 mysql_error() 获取错误消息.但 myAdmin 什么也没显示.

In my php scripts I'm able to get the error message via mysql_error(). But myAdmin shows nothing.

我用谷歌搜索了很多,但没有找到任何有用的东西.

I googled a lot but I didn't find anything useful.

如何让它显示错误信息?

How can I make it show the error messages?

有什么想法吗?

推荐答案

根据您得到#1064 -"作为输出这一事实判断,我只能在 phpMyAdmin 3.3.9.2 源代码中找到两个可能出现错误的地方发生.第一个是调用 mysql_errormysqli_error,具体取决于您的安装使用的后端.我看到你说 mysql_error 工作正常;如果您第一次登录时看到的 phpMyAdmin 信息页面表明正在使用 mysqli,您可能也想检查一下.

Judging by the fact that you get "#1064 -" as output, I can find only two places in the phpMyAdmin 3.3.9.2 source where the error could be occurring. The first is in the call to mysql_error or mysqli_error, depending on which backend your installation is using. I see you said that mysql_error works fine; if the phpMyAdmin information page you get when first logging in indicates that mysqli is being used, you might want to check that too.

但如果 mysql_error 有效,问题似乎更可能出在 library/database_interface.lib.php 中的 phpMyAdmin 字符集转换函数 PMA_DBI_convert_message 中.您可以通过在该函数的最顶部插入 return $message; 来轻松确认这一点,绕过其中的所有其他内容.如果这使它(或多或少)起作用,您可能想要确定 $server_language$GLOBALS['charset'] 被设置为什么;查看转换是否使用 iconvrecode_stringlibiconvmb_convert_encoding;然后尝试找出其中的任何一个未能正确转换错误消息的原因.

But if mysql_error works, it seems more likely that the problem is in phpMyAdmin's character set conversion function PMA_DBI_convert_message in libraries/database_interface.lib.php. You can confirm this easily enough by inserting return $message; at the very top of that function, bypassing everything else in there. If that makes it (more or less) work, you'd probably want to determine what $server_language and $GLOBALS['charset'] are getting set to; see if the conversion is using iconv, recode_string, libiconv, or mb_convert_encoding; and then try to work out why whichever of those is failing to convert the error message properly.

相关文章