How to Configure Ghost with MySQL

Updated on Jul 13, 2018

By default Ghost uses sqlite3 database. Still, if you would like to have your Ghost Blog installed and configured with MySQL database you can reconfigure the default settings in the config.js file following this guide.

 

Login your server via SSH and navigate to your Ghost root directory. If you have followed our Ghost and Node installation guide your Ghost directory should be under /var/www/ghost.

 

Open config.js file using your favorite text editor and locate the Production environment settings which should be somewhere around line 43.

 

You will need to replace the following lines:

 

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost2.db')
            },

 

with your MySQL configuration using the following syntax:

 

       database: {
            client: 'mysql',
            connection: {
                host: 'localhost',
                user: 'database-user',
                password: 'database-user-password',
                database: 'database-name',
                charset: 'utf8'
            },

 

Remember to replace the database host, database-user, database-user-password and database-name with your actual settings. You can now continue with the Ghost installation process

On this page...

    Ghost Hosting

    • Free Ghost Installation
    • 24/7 Ghost Support
    • Free Domain for life
    • Hack-free Protection
    • Fast SSD Storage
    • Free Ghost Transfer
    • Free CloudFlare CDN
    • Immediate Activation
    View More