1

我正在使用 Bolt CMS,我已经从 git 存储库下载了我的站点并将其安装在本地计算机上,没有任何数据库。当我运行它时,Bolt 会创建新的 bolt.db。但是我有自己的文件-bolt.db,如果我替换新文件或者只是将这个bolt.db放在文件夹app/database中,就会出现错误:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]:
General error: 11 database disk image is malformed' in W:\home\localhost\www\opart2\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:92
Stack trace: #0 W:\home\localhost\www\site\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php(92): PDO->query('PRAGMA synchron...') #1 W:\home\localhost\www\site\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php(931):
Doctrine\DBAL\Driver\PDOConnection->query('PRAGMA synchron...') #2 W:\home\localhost\www\site\app\src\Bolt\Application.php(116):
Doctrine\DBAL\Connection->query('PRAGMA synchron...') #3 W:\home\localhost\www\site\app\src\Bolt\Application.php(69):
Bolt\Application->initDatabase() #4 W:\home\localhost\www\site\app\bootstrap.php(50): Bolt\Application->initialize() #5 W:\home\localhost\www\site\index.php(24):
require_once('W:\home\localho...') #6 {main} Next exception 'Doctrine\DBAL\Driver\PDOException' with message 'SQLSTATE[HY000]: General error: 11 databa in W:\home\localhost\www\site\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractSQLiteDriver.php on line 84

我怎样才能得到我的数据库?在这种情况下,PhpmyAdmin 可以寻求帮助吗?

4

1 回答 1

0

What you are doing it correct, you can just replace the bolt.db with your own database, Bolt will only create a new one if it doesn't find it.

I think here you are running into a separate problem, your sqlite db file is corrupted possibly because you backed it up while it was being used. There's some more info about how to repair in this question: SQLite3 database or disk is full / the database disk image is malformed

As of the 1.6.x versions of Bolt you can also specify an alternate location for your Sqlite database. Within your config.yml file you can set both the path and the databasename. eg:

database:
    driver: sqlite
    databasename: mydb
    path: /path/to/folder
于 2014-08-13T06:18:45.437 回答