php mysql 数据库用户连接处理

发布于 2024-08-25 11:06:01 字数 283 浏览 3 评论 0原文

在 PHP 中处理 mysql 数据库用户连接的最佳方法是什么?

我有一个在 MySQL 上运行 PHP 应用程序的 Web 服务器。我为应用程序创建了一个数据库用户:dbuser1,访问权限有限 - 仅用于查询、插入和更新表。没有更改表。

现在的问题是,我是否应该在我的脚本中广泛使用相同的 dbuser1,因此,如果当前有 100 个用户使用我的系统,因此有 100 个并行运行的脚本,它们都使用相同的 dbuser1 连接到数据库?或者我应该创建一些用户并为每个脚本分配不同的用户或 dbuser 之间的负载平衡?

What is the best way to handle mysql database users connection in PHP?

I have a web server running a PHP application on MySQL. I have created a database user for the application: dbuser1 with limited access - only for query, insert and update tables. No alter table.

Now the question is, should i use the same dbuser1 widely in my scripts, so if there are 100 current people using my system and hence 100 scripts running parallel they all connect to the database with the same dbuser1? or should i create a few users and assign each script a different user or load-balance between the dbusers ?

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

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

发布评论

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

评论(1

归属感 2024-09-01 11:06:01

只需使用相同的用户即可。只要该用户具有适当的访问权限(听起来您已经涵盖了),就可以了。

您可能需要检查您的 MySQL 安装是否配置为允许足够的并发连接来支持您的预期使用负载,但默认设置对于大多数站点来说应该足够了。

Just use the same user. As long as that user has appropriate access rights (and it sounds like you've got that covered), you'll be ok.

You might want to check that your MySQL installation is configured to allow enough concurrent connections to support your expected usage load, but the defaults should be fine for most sites.

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