Prerequisites
- A Web Hosting service with OnetSolutions
- Access to your cPanel account
Creating a Database
1
Log in to cPanel
Access your cPanel account through the OnetSolutions dashboard.
2
Open MySQL Databases
In the “Databases” section, click “MySQL Databases”.
3
Create the database
Enter a name under “Create New Database” and click “Create Database”. cPanel prefixes it with your account name, so
shop becomes username_shop — the prefixed form is what your application needs.4
Create a user
Scroll to “MySQL Users”, enter a username and a strong password, then click “Create User”. The username is prefixed the same way.
5
Link the user to the database
Under “Add User To Database”, select the user and the database, click “Add”, then grant “ALL PRIVILEGES” on the next screen.
Connection Settings
Use these values in your application’s configuration:localhost is correct because the application and the database run on the same server. Remote connections are not open by default — an application hosted elsewhere cannot reach this database without additional configuration.Using phpMyAdmin
phpMyAdmin is the web interface for inspecting and editing your data directly.1
Open phpMyAdmin
In the “Databases” section of cPanel, click “phpMyAdmin”. It opens already authenticated — there is no separate password.
2
Select your database
Pick it from the list on the left. Tables appear underneath.
3
Work on the data
Use “Browse” to read rows, “Search” to filter, and “SQL” to run a query.
Exporting and Importing
Export before any risky change, and to move a site between hosts.1
Export
Select the database, open the “Export” tab, keep the “Quick” method and the SQL format, then click “Export”. The file downloads to your computer.
2
Import
Select the target database, open the “Import” tab, choose your
.sql file and click “Import”.Large imports can exceed the upload limit. If the file is too big, compress it to
.sql.gz — phpMyAdmin accepts compressed dumps and the size drops considerably.Troubleshooting
Error establishing a database connection
Error establishing a database connection
Check the four values in order: prefixed database name, prefixed username, password, and host set to
localhost. Then confirm the user is actually linked to the database with privileges granted.Access denied for user
Access denied for user
Either the password is wrong, or the user has no privileges on that database. Re-adding the user to the database and granting ALL PRIVILEGES resolves the second case.
The import stops partway
The import stops partway
Usually the file exceeds the upload or execution limit. Compress the dump, or split it into several files and import them in order.
Unknown database
Unknown database
The name is missing its prefix.
shop does not exist; username_shop does.
