AppLaunch Docs

Create and manage MySQL databases

Create databases and users, grant privileges, connect PHP, and use external database tools safely.

3 min read Updated 29 July 2026

Each PHP site has database controls under PHP Sites → your site → Database. The nested tabs are Connection, Databases, Users, and Privileges.

Before you begin

  • Wait until the PHP site has finished provisioning.
  • If the dashboard says the node is offline, wait before creating, changing, or deleting database resources.
  • Decide on one database and one dedicated user for each application. This limits the effect of a leaked credential.

Create a database

  1. Open Dashboard → Services and select the PHP + MySQL service.
  2. Open PHP Sites, choose the site, then select Database.
  3. Open Databases and click Create Database.
  4. Enter a short name containing no customer data, password, or secret.
  5. Click Create and wait for the operation to reach its ready state.

The final connection name may include an AppLaunch-managed prefix. Copy the exact name shown in the database list rather than assuming it matches the text you entered.

Create a database user

  1. Open Users and click Create User.
  2. Enter a username.
  3. Enter a password, or leave the password empty to have AppLaunch generate one.
  4. Set the allowed host. Use text% only when the user must connect from multiple addresses; use a specific public IP for tighter external access.
  5. Select at least one database to assign.
  6. Click Create user.

If AppLaunch generates a password, save it immediately in a password manager. The credential becomes usable when the queued operation reaches ready.

Grant or revoke privileges

New users receive ALL PRIVILEGES on databases selected during creation. To change access:

  1. Open Privileges.
  2. Select the database user.
  3. Click Grant Privileges.
  4. Select a database and only the privileges the application needs.
  5. Submit the change and wait for it to complete.

Existing privilege groups are shown by database. Use the revoke action to remove a group of privileges that is no longer required. Removing required privileges can immediately break the application.

Connect from PHP on AppLaunch

Open Connection and copy the internal values. Code running inside the PHP site normally connects to textmysql on port text3306.

php<?php
$dsn = 'mysql:host=mysql;port=3306;dbname=YOUR_DATABASE;charset=utf8mb4';
$pdo = new PDO($dsn, 'YOUR_USERNAME', 'YOUR_PASSWORD', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);

Replace all three placeholders with the exact values shown in AppLaunch. Store the password outside the public document root, preferably in environment configuration. Do not commit it to Git.

Connect from your computer

Use the External Host and External Port shown under Connection, plus the exact database name and user credentials. Do not substitute textmysql; that hostname is only available inside the hosted service.

The user account's allowed host must permit your public IP. You can change it from Users → Change Allowed Host. Then connect with MySQL Workbench, DBeaver, HeidiSQL, the MySQL command-line client, or another compatible client.

Use phpMyAdmin

Open Connection and click Open phpMyAdmin. Sign in with a database user shown in Users. If phpMyAdmin is unavailable, the hosting node may not have a public domain configured; use the external connection details or contact support.

Rotate a password

  1. Open Users.
  2. Find the non-primary user and select Rotate password.
  3. Confirm the rotation.
  4. Save the new password immediately.
  5. Wait for the operation to reach ready, then update the application configuration.

Avoid rotating a live application's password until you are ready to update the application. The previous credential stops working after the change is applied.

Delete a user or database

Delete the user first if nothing else needs it, then delete the database. Both actions are destructive. Export required data and create a site backup before proceeding.

If a database connection fails, verify the exact host, port, database name, username, password, allowed host, and privileges in that order. Then review PHP troubleshooting.