简体   繁体   中英

How can I update or install bolt.db on my local machine?

I am using Bolt CMS, and I've downloaded my site from git repository and installed it on the local machine without any db. When I run it, Bolt creates new bolt.db. But I have my own file - bolt.db, if I replace the new file or just place this bolt.db in the folder app/database, there is an error:

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

How can I get my database? Can PhpmyAdmin be for help in this case?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM