Zend Framework 教程 - 我不断收到 sql 错误 - 未知数据库

发布于 2024-11-02 21:00:54 字数 707 浏览 4 评论 0原文

我已经按照留言簿教程一步步进行了。他们使用 load.sqlite.sql 创建数据库并加载数据。但我得到:

C:\quickstart> php scripts\load.mysql.php --withdata  
AN ERROR HAS OCCURED:
SQLSTATE[42000] [1049] Unknown database 'c:\quickstart\data\db\guestbook-dev.db'

My application\configs\application.ini looks like:  
[development : production]  
phpSettings.display_startup_errors = 1  
phpSettings.display_errors = 1  
resources.frontController.params.displayExceptions = 1  
resources.view[] =  
resources.db.adapter = "PDO_MYSQL"  
resources.db.params.username = "root"  
resources.db.params.password = ""  
resources.db.params.host = "localhost"  
resources.db.params.dbname = "C:\quickstart\data\db\guestbook-dev.db"

I have following the guestbook tutorial step by step. They use a load.sqlite.sql to create the database and load it with data. But i get:

C:\quickstart> php scripts\load.mysql.php --withdata  
AN ERROR HAS OCCURED:
SQLSTATE[42000] [1049] Unknown database 'c:\quickstart\data\db\guestbook-dev.db'

My application\configs\application.ini looks like:  
[development : production]  
phpSettings.display_startup_errors = 1  
phpSettings.display_errors = 1  
resources.frontController.params.displayExceptions = 1  
resources.view[] =  
resources.db.adapter = "PDO_MYSQL"  
resources.db.params.username = "root"  
resources.db.params.password = ""  
resources.db.params.host = "localhost"  
resources.db.params.dbname = "C:\quickstart\data\db\guestbook-dev.db"

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

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

发布评论

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

评论(1

海风掠过北极光 2024-11-09 21:00:54

再看一下快速启动,您使用了错误的适配器

resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH."/../data/db/guestbook.db"

APPLICATION_PATH 在 /public 目录的 index.php 文件中设置

编辑:

正如您所指出的,您正在使用 MySQL,那么适配器是正确的,并且数据库名称错误。
查看您使用的数据库名称并更改配置。它当前正在您的文件系统中而不是 MySQL 数据库中查找数据库。

Have another look at the quick start, you're using the wrong adapter

resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH."/../data/db/guestbook.db"

APPLICATION_PATH is set in the index.php file in the /public directory

Edit :

As you've pointed out that you're using MySQL then the adapter is correct and the dbname is wrong.
Have a look what the database you are using is called and change config. It's currently looking for a database in your file system not in your MySQL database.

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