How do I create a MYSQL database?
Learn how to create a MySQL database and user in cPanel through Hostworld hosting. This guide covers using the Database Wizard for guided setup or the manual Manage My Databases option, plus how to configure remote connections.
Create a MySQL database in cPanel using MySQL Database Wizard or Manage My Databases, then add a user with the right privileges. Log in via your Hostworld client area, follow the Wizard for a guided flow, or do it manually in Manage My Databases.
Before you start
- Your Hostworld client area login at portal.hostworld.uk.
- A database name and a strong password for the new MySQL user.
- If you will connect from outside the server, the client IP you will allowlist.
Step 1: Log in to cPanel from the Hostworld client area
- Sign in at portal.hostworld.uk.
- Go to Services, then My Services, and click your hosting product.
- Click Login to cPanel. WHMCS provides single sign on. If you see “Action Failed: Unable to auto-login”, open a support ticket.
Step 2: Create the database and user with the Database Wizard
- In cPanel, open MySQL Database Wizard. On newer cPanel it may be labelled Database Wizard.
- Enter the database name. cPanel may prepend a prefix based on your cPanel username. Copy the full name exactly as shown. MySQL limits names to 64 characters.
- Create the database user and a strong password. Again, copy the full username including any prefix.
- Grant privileges to the user for that database. For most apps, select All Privileges to start, then save.
- Keep a note of database name, username and password for your application’s configuration.
Step 3: Or create and link them in Manage My Databases
If you prefer the manual route, use cPanel’s MySQL Databases. On newer cPanel this is Manage My Databases. The steps are:
- Create New Database. Copy the full name with prefix.
- Create a MySQL User with a strong password.
- Add User to Database, then grant the required privileges. Skipping this link step causes “Access denied” or “Error establishing a database connection”.
Step 4: Get connection details or allow remote access
- For sites on the same hosting server, use host: localhost. Many stacks use a local socket when you specify localhost.
- For remote connections, open cPanel’s Remote MySQL. On newer cPanel this is Remote Database Access. Add the client’s IP and connect over TCP port 3306. Do not allowlist “%”. Using 127.0.0.1 forces TCP and behaves differently from localhost.
Step 5: Undo or delete if you created the wrong thing
- To revoke access only: in Manage My Databases, remove the user from the database.
- To remove the user: delete the MySQL user in Manage My Databases.
- To remove the database: delete it in Manage My Databases. This is permanent. Back up first.
If it does not work
- Access denied or database connection errors: you likely did not add the user to the database or did not grant the needed privileges. In Manage My Databases, use Add User to Database, then grant privileges.
- Wrong names in your app: most cPanel accounts add a prefix to database and user names. Use the exact names shown in cPanel, including the prefix, and update your application’s configuration.
- Remote connection fails: add your client IP in Remote MySQL or Remote Database Access, and connect to port 3306. If you used localhost, try the server hostname or its IP. If any screen does not match what you see, open a support ticket.
What next
For deeper reference, see cPanel’s guides to Manage My Databases and the Database Wizard. If you are comparing hosting with a server you manage yourself, start with our VPS guides and the Linux VPS page.
Common questions
Are there limits on database and user names?
MySQL limits each name to 64 characters. cPanel may prepend a prefix based on your cPanel username plus an underscore. Always copy the full names exactly as cPanel displays them. Very long names can hit limits sooner because of the prefix and how underscores count.
Can I create a database in phpMyAdmin?
No. phpMyAdmin is for managing data inside an existing database, for example tables, queries and imports. On shared hosting, create databases and users in cPanel using Manage My Databases or the Database Wizard. Creating or deleting databases in phpMyAdmin can break cPanel’s mapping.
How do I change a database user password without downtime?
Change it in cPanel’s Manage My Databases under MySQL Users. Then update your application’s database settings with the new password immediately. If you change the password but do not update the application, your site will go offline until it is corrected.
Was this article helpful?
0 people found this helpful