Create MySQL databases and users
Create a MySQL database and user in the hosting control panel, grant or revoke permissions, and delete a database after you have a backup.
Shared hosting stores site data in MySQL / MariaDB. Create one database per application, then a user that can only reach that database.
Create a database
- Open the hosting control panel from the client area.
- Open Databases / MySQL.
- Create a database. The panel adds your account prefix to the name (for example
account_shop); use the full name in the app config. - The database host is
localhostfor sites and apps on your CR Servers hosting. To connect from outside the server, open a ticket.
Create a user
Create a database user with a strong password. Do not reuse the hosting or client-area password. The user also gets the account prefix (for example account_shopuser).
The panel doesn't show the password again after you set it. If it's lost, set a new one for that user and update the app config.
Grant, edit, or revoke permissions
- Open the user ↔ database permissions screen.
- Grant the user access to the new database (typically all privileges for that one database).
- Edit later if you need a read-only user for reporting.
- Revoke access when a user should no longer reach that database.
The application’s wp-config.php or equivalent needs the full database name, user, password, and host.
Connect from PHP
<?php
$pdo = new PDO(
'mysql:host=localhost;dbname=account_shop;charset=utf8mb4',
'account_shopuser',
'the-database-password',
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
Keep these values in a config file that visitors can't download: a .php file outside the html folder, or, if your FTP access is limited to a folder inside html, a .php file in a subfolder (for example private/) with an .htaccess containing Require all denied. Never put the password in JavaScript or HTML.
phpMyAdmin
If the panel offers phpMyAdmin (or another SQL browser), use it to inspect tables and run one-off queries. Prefer application backups and imports for large changes.
Delete a database
Download or confirm a backup first. Deleting a database removes its tables permanently.
- Confirm no live site still points at that name.
- Revoke users from the database if the panel asks you to.
- Delete the database from the same MySQL list.
Open a ticket if you need a restore from a hosting snapshot after a mistaken delete.