Configuration / Database Configuration
Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.2 instead?
Bolt supports three different database engines: SQLite, MySQL and PostgreSQL. Each has its benefits and drawbacks.
- SQLite - is a (file-based) database. Bolt stores the entire database as
a file in the
app/database
directory. Since it's a regular file, it's easy to make backups of your database if you use SQLite. The main benefit of SQLite is that it requires no configuration, and as such, it works 'out of the box' on practically any web server. This is why it's Bolt's default choice. - MySQL - is perhaps the most well-known database engine, which is supported on the majority of web servers. MySQL is very well-known, and there are good third-party tools for maintenance, backup and migration.
- PostgreSQL - is a very well-designed database engine, but not as widely available as MySQL.
Not sure which database to use? We suggest using MySQL if available, and SQLite otherwise.
Note: If you've just installed Bolt, you might
not have the config.yml
-file in app/config
yet. You
will however have a config.yml.dist
-file, in that same directory.
The first time Bolt is run, the .yml.dist
-files will be
automatically copied to .yml
-files. If you wish to do some
configuration before you first run Bolt, just copy
config.yml.dist
to config.yml
manually.
If you wish to edit the database configuration, you have to change the settings
in app/config/config.yml
. Apart from SQLite, you can use MySQL and PostgreSQL
as database systems. Set the database, username and password:
database:
driver: mysql
username: bolt
password: password
databasename: bolt
or:
database:
driver: postgres
username: bolt
password: password
databasename: bolt
Note: The config file is in the YAML format, which means that the indentation is important. Make sure you leave leading spaces intact.
If the hostname or port are something else than localhost:3306
, you can add them like
this:
database:
driver: mysql
username: bolt
password: password
databasename: bolt
host: database.example.org
port: 3306
The default prefix for the database tables is bolt_
. You can change this with the prefix
option like so:
database:
driver: mysql
username: bolt
password: password
databasename: bolt
prefix: yourapp
Other settings in the config.yml
file can be changed later on, directly from
the Bolt backend.
Open your Bolt site in your browser, and you should be greeted by the screen to set up the first user. Do so, and log in to the Bolt Backend. You should now see the (empty) Dashboard screen, and you'll be able to add some dummy pages, using the built-in Loripsum tool. After you've done this, you should see some dummy content, and you're good to go!
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.