How to Create MySQL Database in cPanel
MySQL database is where your website stores its data. If you use WordPress, Joomla, or other web applications that require a database, you must create one before installation. The process is easy and only takes a few minutes.
Steps to Create Database
1. Open MySQL Databases
- Login to your Satelitweb cPanel hosting
- Find the DATABASES section
- Click MySQL Databases
2. Create New Database
- In the Create New Database section, type your desired database name
- Database name usually gets prefixed with cPanel username, resulting in something like username_dbname
- Click Create Database
- Confirmation will appear that database was created
- Click Go Back to return
3. Create Database User
Database and user are separate. You must create a user before you can access the database.
- Scroll to MySQL Users section
- In Add New User, type your desired username
- Create a strong password. Click Password Generator for automatic generation
- Note or save this password as you will need it later
- Click Create User
4. Connect User to Database
- Scroll to Add User To Database section
- Select the newly created user from dropdown
- Select the newly created database from dropdown
- Click Add
- On the privileges page, check ALL PRIVILEGES to give full access
- Click Make Changes
Done! Your database is ready to use.
Information to Note Down
After creating the database, note this information as you will need it during application installation:
Database Name: username_dbname Database User: username_dbuser Database Password: the password you created Database Host: localhost
On Satelitweb hosting, database host is always localhost unless there are special instructions from support team.
Accessing phpMyAdmin
phpMyAdmin is a tool for managing databases through a visual interface. You can view tables, edit data, run SQL queries, import and export databases.
- In cPanel, find the DATABASES section
- Click phpMyAdmin
- Select database in left sidebar
- Now you can view and manage database contents
Importing Database
If you are migrating from another hosting or restoring backup, you need to import database:
- Open phpMyAdmin
- Click target database in left sidebar
- Click Import tab in top menu
- Click Choose File and select SQL file from computer
- Scroll down and click Go
- Wait until process completes
Maximum import size via phpMyAdmin is usually around 50MB to 128MB depending on server settings. For larger files, contact Satelitweb support for command line import assistance.
Exporting Database
Export is useful for backup or migrating to another hosting:
- Open phpMyAdmin
- Click the database you want to export
- Click Export tab
- Choose Quick for fast export or Custom to configure options
- Leave format as SQL
- Click Go
- SQL file will download
Deleting Database
- Open MySQL Databases in cPanel
- Scroll to Current Databases section
- Find the database you want to delete
- Click Delete next to it
- Confirm deletion
Be careful, deleted data cannot be recovered. Make sure you have backup before deleting.
Database Security Tips
- Use strong password minimum 16 characters with combination of letters numbers and symbols
- Do not use easily guessed database or user names
- Give minimum required privileges, not always ALL PRIVILEGES
- Backup database regularly
- Do not share database information with unauthorized people
Troubleshooting
Error establishing database connection:
- Check database name, username, and password are correct
- Make sure user has been added to database
- Check hostname, usually localhost
- Make sure database is not empty or corrupt
Cannot create database:
- May have reached database limit in hosting package
- Database name might already be in use
- Contact support for checking
Import failed:
- File too large, try splitting or ask support for help
- Wrong file format, must be SQL
- There are errors in the SQL file
Need more help with databases? Satelitweb technical team can help troubleshoot your database issues. Open a support ticket and attach screenshots of any errors you see.