Databases and users
How Bahriya manages MySQL databases and users: declare them as configuration, get a dedicated user per database, and keep hand-made schemas untouched.
A MySQL instance can hold several logical databases. On Bahriya you declare them as part of the instance's configuration — a list of database names, each with the user that owns it — and the platform makes the instance match.
databases:
- name: orders
username: orders-app
- name: reporting
username: reporting-roAt least one database is required.
What the platform does for each entry
- Creates the database (schema) if it does not exist.
- Creates the user with a generated password, granted all privileges on that database only.
- Keeps both in place across restarts, failovers and plan changes.
Passwords are never part of the configuration and never shown in a read. Reveal or rotate them from the instance's detail page or with reis mysql:credentials — see Connecting to MySQL.
Adding a database
Add an entry and save (or terraform apply, or reis apply). The database and its user appear on the running instance; nothing restarts for an addition and other databases are untouched.
Removing a database drops it
Removing an entry drops that database and its user, with all their data, in every region. It cannot be undone except by restoring from a backup.
Because it is destructive, every surface makes it explicit:
- Console — saving a list that drops a database asks you to type the instance handle first.
- Reis —
mysql:updatewith a shorter--databaseslist asks for the handle interactively, and refuses under--no-interactionunless you pass--force. - Terraform — the plan shows the entry leaving
databases; review it before you apply.
What the platform never touches
The platform keeps its own record of the databases it created. Databases and users you create yourself over SQL — a scratch schema, a migration table in another schema, a read-only user for a BI tool — are never altered or dropped by the platform, whatever the list says. Only entries that came from the list can be removed by the list.
You still own everything inside a database: tables, indexes, views, stored routines and the data.
Names
- Database names: a lowercase letter followed by up to 63 lowercase letters, digits or underscores.
- Usernames: a lowercase letter followed by up to 31 lowercase letters, digits, underscores or hyphens.
- Each name and each username can appear once.
- The system schemas (
mysql,sys,information_schema,performance_schema) and a small set of usernames the platform uses itself (includingroot) are reserved.
The root user
Every instance also has a root user for administration — creating extra users by hand, inspecting the server, running maintenance. Reveal its password the same way as any other. Give applications their own database user rather than root: it limits what a leaked credential can reach.