PHPMyadmin 不显示 mysql 错误消息
我在我的网站上安装了 phpMyAdmin 并且它可以工作。但是当我错误输入查询时,它不会显示 mysql 错误消息,仅显示错误代码。
1064 -
我预计会出现以下情况:
1064 - 您的废话中有错误...
如果没有错误消息,很难知道出了什么问题。
在我的 php 脚本中,我可以通过 mysql_error() 获取错误消息。但 myAdmin 什么也没显示。
我用谷歌搜索了很多,但没有找到任何有用的东西。
我怎样才能让它显示错误消息?
有什么想法吗?
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 -
I expect the following:
1064 - You have and error in your blah blah...
Without an error message it's difficult to know what's wrong.
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?
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从您得到“#1064 -”作为输出的事实来看,我只能在 phpMyAdmin 3.3.9.2 源代码中找到两个可能发生错误的位置。第一个是对
mysql_error
或mysqli_error
的调用,具体取决于您的安装使用的后端。我看到你说mysql_error
工作正常;如果您第一次登录时看到的 phpMyAdmin 信息页面表明正在使用 mysqli,您可能也想检查一下。但如果 mysql_error 有效,则问题似乎更可能出在libraries/database_interface.lib.php 中phpMyAdmin 的字符集转换函数
PMA_DBI_convert_message
中。您可以通过在该函数的最顶部插入return $message;
来轻松确认这一点,绕过其中的其他所有内容。如果这使它(或多或少)工作,您可能想要确定$server_language
和$GLOBALS['charset']
设置为什么;查看转换是否使用iconv
、recode_string
、libiconv
或mb_convert_encoding
;然后尝试找出其中任何一个未能正确转换错误消息的原因。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
ormysqli_error
, depending on which backend your installation is using. I see you said thatmysql_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.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 insertingreturn $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 usingiconv
,recode_string
,libiconv
, ormb_convert_encoding
; and then try to work out why whichever of those is failing to convert the error message properly.服务器可能无法正确访问 LOCALE 设置。它发生在 chroot/chjail 环境或配置不佳的情况下。
根据@Anomie 的回答,我做了一个解决方法。
对于 phpmyadmin 4.4.3 更改文件
libraries/DatabaseInterface.class.php
中的后备设置对于某些旧版本,编辑文件
libraries /database_interface.lib.php
并设置数组 $encodings => 'english'
值改为UTF-8
(~第 273 行),Probably, Server cannot correctly access LOCALE settings. It happens on chroot-ed / chjail-ed environments or poor configuration.
Based on @Anomie answer, I made a workaround.
For phpmyadmin 4.4.3 change the Fallback setting in file
libraries/DatabaseInterface.class.php
For some older versions, edit file
libraries/database_interface.lib.php
and setarray $encodings => 'english'
value toUTF-8
(~line 273),你有没有看到 :
在文档中?
Did you see :
In the docs ?
有同样的问题,通过在我的浏览器中禁用 phpmyadmin 的 FireFox 插件 uBlock(版本:Origin 1.25.2)解决了这个问题。
Had the same problem, which was solved by disabling the FireFox add-on uBlock (version: Origin 1.25.2) in my browser for phpmyadmin.