MySQL for your PHP projects
Create a database from your project settings and connect from PHP. Each project can have one MySQL database with its own credentials.
When you need a database
Use MySQL when your application needs to keep records between requests: form submissions, catalogue items or notes. PHP handles the request and queries the database; the browser receives the result.
The project owner creates the database and reads its generated name, user and password in the dashboard. Copy those exact values into your server-side configuration.
CRUD exercises
Create tables and practise adding, editing and deleting test records.
Catalogues
Keep entries in tables instead of editing one HTML file per item.
Saved submissions
Validate form input in PHP before storing it.
How to publish it
Create a PHP project
Start with a project in your dashboard and upload a PHP entry file you can test.
Create the project database
As the project owner, use its database action. One provisioned database is supported per project.
Use the generated credentials
Copy the database name, user and password into server-side configuration. Use the exact values, not the project slug as a guess.
Test before adding application tables
Check the connection with a small query, then create your application schema and use prepared statements for user input.
Example file
<?php
$pdo = new PDO(
'mysql:host=localhost;dbname=YOUR_DATABASE;charset=utf8mb4',
'YOUR_DB_USER',
'YOUR_DB_PASSWORD',
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false,
]
);
echo $pdo->query('SELECT 1')->fetchColumn();Example only — replace placeholders before using it.
Before you upload
- The limit is one database per project, not one table. You can create several tables inside that database.
- Never put database passwords in browser JavaScript, HTML or a public repository. Use prepared statements for user input.
- Connections and queries use shared resources. This is a database for your hosted application, not an unrestricted remote database server.
- Your account has 5 GiB of file storage, shared across its projects. Keep a copy of your work on your own computer.
- This is shared hosting for small projects. For the full resource limits, see the limits page.
Common questions
Can collaborators retrieve credentials from the dashboard?
The database credential action is owner-only. Plan team access carefully and keep secrets in server-side configuration.
Does this also provision PostgreSQL or MongoDB?
No. The database provisioning described here is MySQL. Do not assume a different database engine is available.
Do I need a database for an HTML portfolio?
Usually not. If the site only serves HTML, CSS, JavaScript and images, static hosting is the simpler starting point.