2020-02-18 Setup DB

Preface

Once the web server completed to be deploy. I'm wanted to integrate it to database. So, in this case I'm prefer to use MySQL database.

Run the wizard

I'm just showing up what am I doing now. So that, I'm gonna run the wizard installation. Note this! it still not saving the credentials. So guys, after finishing wizard we must setup DB credentials (fardhu 'ain) in local project too, spesificly atwp-config.php.

DB Credentials

Wordpress need to access this credentials. Such as DB name, username, etc.

wordpress wizard

Choosing DB service

I'm just navigate to Heroku Resources>Addons. And searching for JawsDB and it's free. But maybe this service needed to store a credit card. Just, another option "postgrest" and it's very eligeble to use for setup Wordpress. But, I'm not very good with that 🤪 .

Find DB credentials at: https://dashboard.jawsdb.com/mysql/dashboard

And then, input them to Wordpress application

Add admin user

Now, we have admin user to manage our site at: http://gealtikwordpress.herokuapp.com/wp-admin/

Setup wp-config

In the previous step, wizard installation it hasn't generate wp-config file at the root of project folder. Now, follow this instruction below.

  • create wp-config.php

bima at x220 in /m/F/A/W/w/wordpress
↪ cp wp-config-sample.php wp-config.php
  • setup db credentials

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** MySQL database username */
define( 'DB_USER', 'username_here' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
  • setup Wordpress API

get it from https://api.wordpress.org/secret-key/1.1/salt/

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/
  • Save and push to heroku

bima at x220 in /m/F/A/W/w/wordpress
↪ git add --all
bima at x220 in /m/F/A/W/w/wordpress
↪ git commit -m "Add: wp-config.php"
[master 2df8ad1] Add: wp-config.php
 1 file changed, 90 insertions(+)
 create mode 100644 wp-config.php
bima at x220 in /m/F/A/W/w/wordpress
↪ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.97 KiB | 1.97 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> PHP app detected
...
...
...

What's next?

  • cronjob (Automated task)

Last updated

Was this helpful?