squirrelworks

Stepping through setup of PHPMyAdmin and MySQL in CPanel

Saturday August 16, 2025 | By Michael Banks

Project Goals:
  • Create a sample database within my web-hosting environment’s PHPMyAdmin Interface
  • Populate the DB with Chinook sample data
  • Connect to the DB via PHP
  • Query the DB and print results to HTML


The Chinook sample database was introduced to me by a Professor of mine at Brookhaven College way back in 2014.
The create_chinook.sql file from those days is not working today; throwing several errors

I found a newer version of the file:
https://github.com/lerocha/chinook-database
Download > latest releases > Chinook_MySql.sql

Seeking some background on Chinook: How old is it, who originally created it, etc
Created as an alternative to the Northwind database, which appears to go back to Access ‘95.


The Github/Lerocha page appears to be the ‘official’ place to get it.


In my shared hosting provider’s CPanel, I’ll take a look at phpMyAdmin.

Having worked with different hosting providers’ CPanel’s, I already know that this one is more limited than previous ‘basic plans’ I’ve used, in terms of access.

The good news is that my hosting plan allows for the creation of 2 databases.
I tried it via
file import
sql query

I attempt to create the chinook by Importing the SQL file, resulting error 1044:


The issue goes back to the limited permissions on my hosting account. As a security measure, the CPanel is auto-logged into from the hosting UI... This is done using a temp account 'cpses' = CPSession....

Then within CPanel, the phpMyAdmin interface is only available to the 'cpses' temp account; you are automatically signed in as that, and cannot sign out of it. In this instance of phpMyAdmin I do not have a 'logout' button.

That means I cannot log in as a different user, and that means I am stuck as the 'cpses' account when I'm in both Cpanel and phpMyAdmin. That account apparently does not have rights to create a database. So the error message is pretty straightfoward. I just had a hard time believing it, since in the past this was not the case with a different hosting provider (hostgator).. The Cpanel in that case was m ore 'full-featured'.

So my Cpanel is a basic configuration and the only account available to run SQL queries within phpMyAdmin does NOT have the ability to create databases.

I can only create databases via the CPanel 'mysql databases' tile. I do that, and grant a database user account the needed rights to the db.

These first lines of the CHinook script will not work in my situation....

/******************************************************************************* Drop database if it exists ********************************************************************************/ DROP DATABASE IF EXISTS `Chinook`; /******************************************************************************* Create database ********************************************************************************/ CREATE DATABASE `Chinook`; USE `Chinook`;



... because no matter what, with my current hosting plan, I cannot 'create' a db from an SQL query. Just pointing out that I am satisfied with that as an answer, and that I didnt overlook anything in the Cpanel UI or andy of the config files available in my cpanel.

Here Im showing the phpMyAdmin UI - there is no 'switch user' at left, in the top menu icons. (there are 5 icons, no 6th)



So the finding was that
A) I could successfully create dbs from Cpanel only, not phpMyAdmin/mySql
B)I could successfully create a table in that db and then successfully run queries on that table from phpMyAdmin/mySql

Nothing relevant in the config files that are accessible (see research below where htis was found to be a fix in other cases)





We can see in the left menu database tree, I created 'squirrel_chinook' -- that was done via CPanel:



Within that DB there is a table, 'test', with rows a,b,c,d -- I created that to see whether or not I could.

Im showing the error here, resulting from running query at server level, not running query against any db or table. Top of screen the dark grey bar shows current location.





Creating the DB and user via Cpanel:






I'm just testing the 'two database' limit here - as expected it warns that a third requires plan upgrade with hosting company.




Research: Digging around on that 'cpses' account - it took me awhile to realize it's a differnt string each time you login.

based on these various forum threads, that is because it's a temp account used to auto-login to cpanel, which is tied to my hosting login account












With that research out of the way, the workaround is to only use the table creation data from the Chinook script -- omitting the first lines that create the DB. Those arent needed since I created the DB via cpanel. Once that was done, I plugged in the table creation SQL data from the Chinook script, into the SQL window for my DB.



Here I'm showing that the errors in my orginal Chinook file from years ago are not just about Cpanel permissions -- there are syntax issues, so I went loking for a better Chinook script.









Chinook database diagram:




Next: database interaction