Database Services

2 min read Updated 1 week ago

Database Services

Ploi Cloud makes it easy to add database services to your applications. Supported databases include MySQL, PostgreSQL, and MongoDB.

Adding a Database

  1. Navigate to your application

  2. Click "Add Service"

  3. Select your database type

  4. Choose a database version:

    • MySQL: 8.0, 5.7

    • PostgreSQL: 16, 15, 14, 13

    • MongoDB: 7.0, 6.0, 5.0

  5. Configure the resources:

    • CPU: Select from available plans

    • Memory: Automatically allocated (4GB per CPU core)

    • Storage Size: Set during creation (cannot be changed later)

  6. Click "Create database"

Connection Details

Database credentials are automatically generated and injected as environment variables into your application:

MySQL

For Laravel applications:

  • DB_CONNECTION - Set to 'mysql'

  • DB_HOST - Database hostname

  • DB_PORT - Port 3306

  • DB_DATABASE - Database name

  • DB_USERNAME - Database username

  • DB_PASSWORD - Database password

For WordPress applications:

  • WORDPRESS_DB_HOST - Database hostname

  • WORDPRESS_DB_NAME - Database name

  • WORDPRESS_DB_USER - Database username

  • WORDPRESS_DB_PASSWORD - Database password

PostgreSQL

  • DB_CONNECTION - Set to 'pgsql'

  • DB_HOST / POSTGRES_HOST - Database hostname

  • DB_PORT / POSTGRES_PORT - Port 5432

  • DB_DATABASE / POSTGRES_DB - Database name

  • DB_USERNAME / POSTGRES_USER - Database username

  • DB_PASSWORD / POSTGRES_PASSWORD - Database password

  • POSTGRESQL_URL / POSTGRES_URL - Full connection string

MongoDB

  • MONGODB_URI - Full connection string with authentication

  • MONGODB_HOST - Database hostname

  • MONGODB_PORT - Port 27017

  • MONGODB_DATABASE - Database name

  • MONGODB_USERNAME - Database username

  • MONGODB_PASSWORD - Database password

Backups

The platform performs automatic nightly backups of all applications and their databases. Backups can be restored to create a new copy of your application with all its data.

Managing Databases

To manage your database:

  1. Go to the service in your application

  2. View service logs to monitor database activity

  3. Restart the service if needed

  4. Enable debug access for temporary external connections

Note: Storage size cannot be changed after creation. Plan your storage needs accordingly.