如何在 application.ini 文件中定义 PDO_MYSQL

发布于 2024-12-06 19:16:49 字数 427 浏览 0 评论 0原文

我尝试将 mysql 连接到 zend 应用程序,但出现异常: SQLSTATE[28000] [1045] 用户 'user'@'host' 的访问被拒绝(使用密码:是)

resources.db.adapter = PDO_MYSQL
resources.db.isDefaultAdapter = true
resources.db.params.host = *host*
resources.db.params.username = *user*
resources.db.params.password = *password*
resources.db.params.dbname = *dbname*

上述条目仅存在于 application.ini 中。 此代码在我的 PC 的本地主机上运行,​​但不在服务器上运行。

I am try to connect mysql to zend appllication but its gives exception : SQLSTATE[28000] [1045] Access denied for user 'user'@'host' (using password: YES)

resources.db.adapter = PDO_MYSQL
resources.db.isDefaultAdapter = true
resources.db.params.host = *host*
resources.db.params.username = *user*
resources.db.params.password = *password*
resources.db.params.dbname = *dbname*

Above noted entry is only in application.ini.
This code is run on localhost in my PC but not on server.

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

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

发布评论

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

评论(2

℉服软 2024-12-13 19:16:49

您无权使用该用户名和密码登录 Mysql 服务器。
检查 phpMyAdmin 用户 rdvscoin_main 是否有足够的权限访问数据库 rdvscoin_corporate。

如果Mysql服务器位于单独的机器上,请检查用户是否可以从您的代码所在的机器登录。

You do not have access to login to Mysql server with that username and password.
Check in phpMyAdmin if user rdvscoin_main has enough privilege to access the database rdvscoin_corporate.

If the Mysql server is on a separate machine check if user can login from the machine where your code is located.

魂牵梦绕锁你心扉 2024-12-13 19:16:49

您需要像这样更改代码:

resources.db.adapter = PDO_MYSQL
resources.db.isDefaultAdapter = true
resources.db.params.host = *host* (put localhost here assuming server host is also localhost)
resources.db.params.username = *user* (put the user name which you used in your database)
resources.db.params.password = *password* (put the password you used in your database)
resources.db.params.dbname = *dbname* (use the database you are using)

希望它有效!

You need to change the code like this:

resources.db.adapter = PDO_MYSQL
resources.db.isDefaultAdapter = true
resources.db.params.host = *host* (put localhost here assuming server host is also localhost)
resources.db.params.username = *user* (put the user name which you used in your database)
resources.db.params.password = *password* (put the password you used in your database)
resources.db.params.dbname = *dbname* (use the database you are using)

Hope it works!

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