Creating a Database
Now that you've created a website for your example.com
PHP application, you need to connect it to a database.
Example
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.inc.php
config/
directory