如何“测试” MySQL服务器完整性?

发布于 2024-10-13 14:09:36 字数 398 浏览 3 评论 0原文

我在共享网络托管上的一些网站遇到了问题 丢失各自 MySQL 数据库的数据绑定。我的提供商不提供对 MySQL 日志的访问。他们周一将让一名服务器工程师调查该问题;不过,我想要一些具体的数据来说明问题的严重程度。

有什么好方法(最好使用 PHP)来获取数据在传输到 MySQL 数据库的过程中被丢弃的证据?有没有现成的工具可以进行此类测试? Drupal 模块将是理想的选择,因为我可以简单地将其安装在我已经配置的站点之一上临时运行?

ps - 是的,我很快就会将网站从共享托管中移出。 :)

I've been having trouble with some of my sites on shared web hosting losing data bound for their respective MySQL databases. My provider doesn't provide access to the MySQL logs. They're having a server engineer look into the problem on Monday; however, I'd like to have some concrete data to illustrate the extent of the problem.

What would be a good way, preferably using PHP, to get proof showing data being dropped on its way to a MySQL database? Is there an existing tool for this kind of testing? A Drupal module would be ideal, since I could simply install that to run temporarily on one of the sites I have configured already?

p.s. - Yes, I'll be moving the sites off of shared hosting shortly. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单挑你×的.吻 2024-10-20 14:09:36

找到代码中执行插入操作的位置。确保它具有错误处理功能。检查从数据库返回的结果。

如果数据库说它已经插入了数据(例如,向您的代码返回成功)并且数据没有插入,那么您已经在mysql中发现了一个巨大的错误。这种情况发生的可能性接近于零(许多其他人广泛使用相同的功能,并且没有像人们预期的那样,如果像 mysql 这样的通用工具出现故障,就会出现数据丢失的广泛报告)。

将调试行添加到代码中,将执行的语句、返回的结果以及代码对语句和返回结果执行的操作写入日志文件。

这一切都归结为您的代码如何处理错误和提交的问题?

Find the place in your code where the insert is actioned. Ensure it has error handling. Check the return from the DB.

If the DB says it has inserted the data (e.g. returns succcess to your code) and the data is not inserted you have found a huge bug in mysql. The likelihood of this being so approaches zero (a large number of other people use the same functionality extensively and there are not widespread reports of data loss as one would expect if a common tool like mysql is failing).

Add debug lines to your code which write out to as log file the statement actioned, the result returned, and what your code does with the statement and the return result.

It all comes down to the question of how does your code handle errors and commits?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文