Knowledge Base/Database

Database Tutorials

Create MySQL databases, manage users & privileges, import/export with phpMyAdmin, repair broken tables and connect remotely from your local machine.

01 Creating a MySQL database

Step 1cPanel → MySQL Databases.
Step 2Under Create New Database, type a short name (e.g. wp_main).
Step 3Click Create Database. The full name becomes cpuser_wp_main (cPanel adds your username as a prefix).
Note Always use the full prefixed name in your application's config — not just the short name.

02 Creating a MySQL user & privileges

Step 1On the same MySQL Databases page, scroll to MySQL Users.
Step 2Enter a username (e.g. wp_user) and a strong password — use the Password Generator.
Step 3Click Create User.
Step 4Scroll to Add User to Database. Pick the user & database, click Add.
Step 5Tick ALL PRIVILEGES and click Make Changes.

03 Opening phpMyAdmin

Step 1cPanel → phpMyAdmin in the Databases section.
Step 2You'll see your databases in the left sidebar — click any to expand its tables.
Step 3Use the top tabs (Browse, Structure, SQL, Search, Insert, Export, Import) to work with each table.

04 Importing a .sql file

Step 1In phpMyAdmin, click the destination database in the left sidebar.
Step 2Click the Import tab at the top.
Step 3Click Choose File and pick your .sql file (or .sql.zip).
Step 4Leave format as SQL and click Go.
Warning If your file is over 50MB, upload it to ~/tmp/ via SFTP and import using WHM → Restore Database or contact support.

05 Exporting a database

Step 1In phpMyAdmin, click the source database.
Step 2Click the Export tab.
Step 3Choose Quick + Format SQL for the simplest export.
Step 4Click Go — your .sql file will download.
Tip Use Custom mode and tick Add DROP TABLE if you plan to re-import over an existing copy.

06 Repairing a corrupted table

Step 1In phpMyAdmin, click the affected database.
Step 2Tick the table(s) showing the error.
Step 3From the dropdown at the bottom, choose Repair table.
Step 4If repair fails, run Check table first, then Optimize table.

From SSH (advanced)

mysqlcheck -r -u USER -p DBNAME

07 Allowing Remote MySQL

By default, cPanel's MySQL only allows connections from localhost. To connect from your laptop or another server, whitelist the IP.

Step 1cPanel → Remote MySQL.
Step 2Enter your public IP address (find at whatismyipaddress.com).
Step 3Click Add Host.
Step 4Connect from MySQL Workbench / TablePlus using:
  • Host: yourdomain.com
  • Port: 3306
  • User: cpuser_dbuser
  • Password: your DB user password
Warning Don't whitelist % (all IPs). Use a static IP or VPN for safety.