CHAPTER 16
Beginner
How to use phpMyAdmin on Shared Hosting | cPanel & Hostinger
Updated: May 16, 2026
15 min read
# CHAPTER 16
Managing Databases on Shared Hosting
1. Introduction
If you are a freelance web developer building WordPress sites for clients, you likely aren't managing complex Linux servers. You are using Shared Hosting (like Hostinger, Bluehost, or cPanel). In a Shared Hosting environment, you do not haveroot access to the server. The hosting company heavily restricts your power to prevent you from crashing the machine for other customers. Because of this, the workflow for creating databases and accessing phpMyAdmin is entirely different than XAMPP. In this chapter, we will master the Shared Hosting workflow.
2. Learning Objectives
By the end of this chapter, you will be able to:- Understand the restrictions of Shared Hosting environments.
- Create databases and users using the cPanel/hPanel GUI.
- Connect restricted users to specific databases.
- Launch phpMyAdmin from a hosting dashboard.
- Understand database prefix naming conventions.
3. The Shared Hosting Restriction
In XAMPP, you opened phpMyAdmin, clicked "New," and typed a database name. If you click "New" in a Shared Hosting phpMyAdmin, you will get a red error: #1044 - Access denied for user. Why? Because on a shared server with 500 other customers, the hosting company physically blocks you from executingCREATE DATABASE commands inside phpMyAdmin. You MUST use their specific Hosting Control Panel to create databases.
4. Workflow 1: cPanel Database Creation
If your host uses standard cPanel (GoDaddy, Bluehost):- 1. Log into your cPanel dashboard.
- 2. Scroll to the "Databases" section. Do NOT click phpMyAdmin yet.
- 3. Click the MySQL Databases icon.
-
4.
Create Database: Type a name (e.g.,
shop). Notice cPanel forces a prefix on the name based on your username (e.g.,client99shop). Click Create.
-
5.
Create User: Scroll down to Add New User. Type a username (
client99admin) and generate a secure password.
- 6. The Critical Step (Linking): Scroll to "Add User To Database." Select your new user and your new database from the dropdowns and click Add.
- 7. A page appears asking for privileges. Check All Privileges and save.
*Only after completing these 7 steps can you go back to the cPanel homepage and click the phpMyAdmin icon!*
5. Workflow 2: Hostinger (hPanel)
Hostinger uses a custom dashboard, but the logic is identical.- 1. Log into Hostinger. Go to Websites -> Manage.
- 2. In the left sidebar, click Databases -> Management.
- 3. You will see a combined form. It asks for Database Name, MySQL Username, and Password all in one place!
- 4. Fill it out and click Create.
- 5. The database instantly appears in a list below. Next to the database name, click the button that says Enter phpMyAdmin.
6. The Forced Prefix Rule
When writing PHP code to connect to your database on XAMPP, your database name wascompanydb.
On Shared Hosting, your login username is usually prefixed to prevent name collisions with other customers on the same server.
If your cPanel username is techguru, your database name mathematically becomes techgurucompanydb. If you forget the prefix in your backend PHP configuration file, your website will fail to connect!
7. Remote Database Connections
What if you want to connect a desktop application (like MySQL Workbench) directly to your Shared Hosting database? By default, Shared Hosts block all external IP addresses for security (IP Whitelisting).- 1. Go to cPanel.
- 2. Click Remote MySQL.
-
3.
In the "Add Access Host" box, type your personal computer's current IP address (or
%to allow all, though highly discouraged).
- 4. Click Add. Your desktop application can now securely tunnel into the shared server.
8. Mini Project: The WordPress Migration
Scenario: Moving a WordPress site from XAMPP to Hostinger.-
1.
XAMPP: Open phpMyAdmin, Export
wpdatabase.sql.
-
2.
Hostinger: Go to Databases -> Management. Create
user99wpdatabaseand useruser99adminwith passwordSecret123!.
- 3. Hostinger: Click "Enter phpMyAdmin."
-
4.
phpMyAdmin: Ensure
user99wpdatabaseis selected in the left sidebar. Click the Import tab. Uploadwpdatabase.sqland click Go.
-
5.
FTP: Edit your
wp-config.phpfile, updating theDBNAME,DBUSER, andDBPASSWORDto match the new cPanel credentials! The site is live.
9. Common Mistakes
- Forgetting the Link Step: In standard cPanel, creating the Database and creating the User are two separate actions. The most common beginner mistake is creating both, but forgetting step 6 (Linking them together). If you don't explicitly link the user to the database and assign privileges, the user cannot see the database in phpMyAdmin, and your PHP application cannot connect.
10. Best Practices
- Use the Wizard: cPanel offers an icon called "MySQL Database Wizard". Always use this. It guides you through creating the database, creating the user, and linking them together in a foolproof, 3-step linear process, preventing you from forgetting the crucial linking step.
11. Exercises
- 1. Why does clicking the "New" database button inside phpMyAdmin fail in a Shared Hosting environment?
- 2. What forced naming convention do Shared Hosts apply to your database names to prevent conflicts with other customers?
12. Database Challenges
You successfully imported your database into cPanel. You updated your PHP backend code with the correct password, but the website throws a "Database Connection Failed" error. Upon inspecting your PHP code, you see:$dbname = "storedatabase";. Your cPanel login username is johnsmith. What architectural mistake caused the failure?
*(Answer: You forgot the forced prefix. In a shared hosting environment, the database name must include the cPanel username prefix. The PHP code must be updated to $dbname = "johnsmithstoredatabase";).*
13. MCQ Quiz with Answers
Question 1
In a standard cPanel Shared Hosting environment, what is the mandatory workflow to deploy a database and access it in phpMyAdmin?
Question 2
By default, attempting to connect a desktop application (like MySQL Workbench or DBeaver) to a Shared Hosting database over the internet will fail. What specific cPanel security feature must be configured to allow this connection?
14. Interview Questions
- Q: Explain the architectural separation of concerns between cPanel (or hPanel) and phpMyAdmin in a Shared Hosting environment. Why is user and database creation stripped away from phpMyAdmin in these specific ecosystems?
- Q: Detail the complete, end-to-end migration process of moving a PHP/MySQL web application from a local XAMPP environment to a live cPanel hosting provider.