Creating a Database

From Sympl Wiki
Revision as of 11:21, 30 July 2022 by Techwilk (talk | contribs) (Clarify config files are in the PHP application)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Now that you've created a website for your PHP application, you need to connect it to a database.


Creating the database

Run sympl create database example to create a database using the Sympl Command Line.

Make a note of the password for later.

This creates a database named example, along with a user of the same name with full access to only that database, and outputs the password. The password is also saved in a files with restricted access in the /home/sympl directory for future reference.

Configuring your application

Now add the database credentials to one your application's configuration files. This will vary depending on your application, so consult it's own documentation.

For our example, the values we need are:

  • Database: example
  • User: example
  • Password: (the password you made a note of earlier)
  • Host: localhost
  • Port: 3306

Common places to find this configuration file in your PHP application are:

  • .env
  • config.php
  • config/ directory