Creating the Database in CPanel

hearty fare

Database - CPanel

While MODX can create its database for you during installation, in most shared hosting plans you are not allowed to create databases or database users. In these common situations, you'll need to use your hosting control panel to create a database and database user. The most common control panel is CPanel, but any control panel's database creation tool should be very similar.

The Solution

Log in to your hosting CPanel control panel, and open the MySQL Database Wizard.

Creating the Database in CPanel

Choose a name for your database. The actual database name will most likely be generated as yourname_dbname, with the first few characters of your CPanel login name prepended to the database name you entered.

Click Next, and create a user for the database. It does not have to be the same as your database name.

Creating the Database User in CPanel

Let the wizard generate the database user's password using the Password Generator button. Make sure to copy and paste it somewhere safe, you will not be able to recover it if you lose it!

Creating the Database Password in CPanel

Set the privileges for the database user. According to the MODX documentation, the minimum privileges are SELECT, INSERT, UPDATE and DELETE for normal operation, while CREATE, ALTER, INDEX, DROP and possibly CREATE TEMPORARY TABLES are required for installation/upgrades and some add-ons.

Assigning Privileges to the User In CPanel

Finally, connect your database with the database user.

Assigning the Database User to the Database

And your database is created. But you need to change the default character set and collation. The character set will determine what kind of characters you can use in your content. The collation determines how text is sorted and compared. Setting the collation for the new database will also set its character set.

Most likely the collation will by default have been set to "latin1_swedish_ci" which is the MySQL configuration default. You'll probably want "utf8_general_ci". To do this, go back to your CPanel and open its phpMyAdmin. Use your new database user and login to log in to phpMyAdmin.

Login to phpMyAdmin

In the panel to the left, click on your new database name. When the database information is open in the left panel, click on the "Operations" tab.

Open Operations tab

If necessary, change the Collation to 'utf8_general_ci', or whichever character set and collation you want to use.

Set Collation

And now you have a new database all ready to install MODX into. Make sure that you have the database name, database user and database login kept safely somewhere. You will need it when you install MODX.