在 phpMyAdmin 中哪里可以找到 MySQL 日志?
在 phpMyAdmin 界面中哪里可以找到 MySQL 的日志(错误、查询等)?
Where can I find the MySQL's logs (errors, queries, etc.) in the phpMyAdmin interface?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我有@rutherford同样的问题,今天新的 phpMyAdmin 3.4.11.1 GUI 是不同的,所以我发现如果有人用更新的信息改进答案会更好。
完整的 mysql 日志可以在以下位置找到:
这就是答案,如果您使用的是 MAMP、XAMPP、LAMP 等,这并不重要。
I had the same problem of @rutherford, today the new phpMyAdmin's 3.4.11.1 GUI is different, so I figure out it's better if someone improves the answers with updated info.
Full mysql logs can be found in:
This is the answer, doesn't matter if you're using MAMP, XAMPP, LAMP, etc.
打开 PHPMyAdmin,不要选择任何数据库并查找
Binary Log
选项卡。您可以从下拉列表中选择不同的日志,然后按
GO
按钮查看它们。Open your PHPMyAdmin, don't select any database and look for
Binary Log
tab .You can select different logs from a drop down list and press
GO
Button to view them.我使用的是 phpMyAdmin 版本 4.2.11。在撰写本文时,我的
Status
选项卡如下所示(展开了一些选项;请注意右下角的“当前设置”):请注意,没有直接可见的“功能”可以允许启用
slow_query_log
等功能。因此,我在互联网上进行了挖掘,因为面向 UI 的答案仅与特定版本相关,因此很快就会过时。那么,如果您没有看到上面的相关答案,您会怎么做?正如这篇文章所述,您可以运行全局查询以启用或禁用
slow_query_log
等。 启用和禁用这些日志的查询并不困难,所以不要害怕,例如SET GLOBAL Slow_query_log = 'ON';
从这里开始,phpMyAdmin 就很漂亮了很有帮助,谷歌搜索一下就能让你很快上手。例如,在运行上述查询后,我可以返回到状态选项卡的
Monitor
窗口下的“指令/设置”选项并查看以下内容(请注意进一步的说明):I am using phpMyAdmin version 4.2.11. At the time of writing, my
Status
tab looks like this (a few options expanded; note "Current settings", bottom right):Note, there are no directly visible "features" that allow for the enabling of things such as
slow_query_log
. So, I went digging on the internet because UI-oriented answers will only be relevant to a particular release and, therefore, will quickly become out of date. So, what do you do if you don't see a relevant answer, above?As this article explains, you can run a global query to enable or disable the
slow_query_log
et al. The queries for enabling and disabling these logs are not difficult, so don't be afraid of them, e.g.SET GLOBAL slow_query_log = 'ON';
From here, phpMyAdmin is pretty helpful and a bit of Googling will get you up to speed in no time. For instance, after I ran the above query, I can go back to the "Instructions/Setup" option under the Status tab's
Monitor
window and see this (note the further instructions):在 phpMyAdmin 4.0 中,您转到 Status >监视器。在那里,您可以启用慢查询日志和常规日志,查看实时监视器,选择图表的一部分,查看相关查询并分析它们。
In phpMyAdmin 4.0, you go to Status > Monitor. In there you can enable the slow query log and general log, see a live monitor, select a portion of the graph, see the related queries and analyse them.
如果您使用 XAMPP 作为服务器,您将发现一个日志目录作为 XAMPP 目录的子目录。如果您还没有尝试过可在任何系统(Windows、Mac OS 和 Linux)上运行的 XAMPP,请在此处找到更多信息:http://www.apachefriends.org/en/xampp.html
If you are using XAMPP as your server, you'll find a logs directory as a child of the XAMPP directory. If you have not tried XAMPP, which runs on any system (Windows, Mac OS & Linux) find more here: http://www.apachefriends.org/en/xampp.html
使用 Performance_schema 数据库和表:
查看手册 这里
Use performance_schema database and the tables:
Check the manual here