Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sqlite3 with mysql on local development #1373

Closed
expatjedi opened this issue Jan 11, 2021 · 5 comments
Closed

Replace sqlite3 with mysql on local development #1373

expatjedi opened this issue Jan 11, 2021 · 5 comments

Comments

@expatjedi
Copy link

Many of us suffering sqlite3 installation on local envoriment so here is a quick solution to replace sqlite3 with mysql. Here's what i did:

  1. Installed mariadb and started. I created a database and assigned a user in it with all grants.
  2. npm install ghost-cli@latest -g
  3. ghost install local

After 3rd step, I encountered usual sqlite3 error and could not start the ghost. Now go ahead the directory where you install ghost and locate the file config.development.json. Open the file and replace the database section with this.

In this example, i used ghostuser but you can choose anything you want.

"database": {
  "client": "mysql",
  "connection": {
    "host": "localhost",
    "user": "ghostuser",
    "password": "ghostuser",
    "database": "ghostuser",
    "charset": "utf8"
  }

Then i started the ghost with ghost start and it worked.

@acburdine
Copy link
Member

@koraylinux another option for using local ghost with mysql is to run ghost install local --db mysql, which should add the automatic prompts for MySQL host, username, password, etc. 😄 Removes any need to manually edit configuration.

@acburdine
Copy link
Member

@koraylinux should have asked also - is there something you're looking for us to fix in the CLI here? or is this more of a "if you'd like to use mysql instead, here's how you'd do it."

@expatjedi
Copy link
Author

There is no problem from your side. I tried to fix sqlite3 problem on my installation but failed so it's kinda way to avoid from sqlite. I did not know the --db prefix. Thanks for the tip!

@nkgst
Copy link

nkgst commented Jan 26, 2021

@koraylinux another option for using local ghost with mysql is to run ghost install local --db mysql, which should add the automatic prompts for MySQL host, username, password, etc. 😄 Removes any need to manually edit configuration.

trying this method brings me to another error. This is may be silly but don't really fluent on mysql.
this is what it prints:
`PS C:\Users\Niccolò\Desktop\Sito\v9> ghost install local --db mysql
√ Checking system Node.js version
√ Checking current folder permissions
√ Checking memory availability
√ Checking free space
√ Checking for latest Ghost version
√ Setting up install directory
√ Downloading and installing Ghost v3.40.5
√ Finishing install process
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ODBC
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: v9_dev
√ Configuring Ghost
√ Setting up instance
× Starting Ghost
One or more errors occurred.

  1. GhostError

Message: connect ECONNREFUSED 127.0.0.1:3306
Help: Unknown database error

Debug Information:
OS: Microsoft Windows 10 Pro, v10.0.18363
Node Version: v14.15.4
Ghost Version: 3.40.5
Ghost-CLI Version: 1.15.3
Environment: development
Command: 'ghost install local --db mysql'`

@acburdine
Copy link
Member

@nkgst generally this means that you don't have mysql installed locally - see here for instructions on how to install MySQL on Windows.

I'm closing this issue since there's nothing to update on the CLI side. If you run into any more issues, please reach out on our forum 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants