Installing Ghost on shared hosting can be though. We have to maintain the media storage, database, even the server by ourselves.
If you have completed installing Ghost on your shared hosting from my previous tutorial. You probably recognized that the database is using sqlite3. It is because we were using the Ghost local install.
Someone asking me and I've been thinking too to move the database from sqlite3 to using MySQL database.
Actually, recently on my hosting provider there is one button easy install Ghost. And this button is installing the Ghost with MySQL configured by default.
I really like this new feature. But, seems like I have to migrate all my content from sqlite3 to MySQL. And I see that this is not easy.
I did a few trials configuring MySQL to the Ghost installation on the shared hosting. Here is how to use MySQL on Ghost installation.
Prepare MySQL Database
Of course before we add the database configuration to the config.production.json
, we have to create new database and new database user.
Go to MySQL® Databases from your CPanel page. Fill the name for the database, then hit "Create Database".

Scroll down to the MySQL Users section. On the Add New User.
Fill the username for the database's name, and the password too. Hit "Create User".

Now lets add user to the database that we just created in the Add User To Database section.

Tick all the user's privilege. Hit "save".

Check if the database username is already connect the database on the Current Database section on the first section.
Plug In MySQL Database To The Ghost Installation
Go to your Ghost installation folder.
Open the config.production.json
. Change your database configuration like below:
...
"database": {
"client": "mysql",
"connection": {
"user": "your-database-username",
"password": "your-database-password",
"database": "your-database-name",
},
},
...
- We change the client from "sqlite3" to "mysql".
- In the connection. Add your database credentials, the database username, database password, and database name.
Hit save.
Stop the Ghost site by using command ghost stop
from SSH command line. Restart the NodeJS. Then start Ghost site by using command ghost start
from SSH command line.
If you have a problem that says something like "field length of 'subscription id' in 'member stripe customer subscriptions' is too long". Try restart the NodeJs and Start the Ghost site again.
Basically, add MySQL as the Ghost database is easy. The important thing you should note is, this configuration better done in the fresh installation of Ghost CMS. Otherwise, if you are planning on migration, you will be dealing with sqlite3 to MySQL conversion and content issues.
Hope that helps!
You can support this blog with cup of a coffee :