Creating a MySQL Database

A MySQL database is used for dynamic websites such as WordPress, Laravel, Joomla, and other CMS or PHP-based projects. Below is a complete guide on how to create a database, a user, and manage it using phpMyAdmin.

Accessing the MySQL Databases section

After logging into the control panel:

  1. Go to the Databases section
  2. Click on MySQL Databases



Here you will see:

  1. Existing Databases
  2. Existing Database Users
  3. The button: Create a Database or a User



As shown in the screenshot, the “Create a Database or a User” function allows you to create everything in one form at once:

  1. A MySQL database
  2. A MySQL user
  3. Automatically assign the user access to the database

This is the simplest and recommended method.

1. Create a Database

In the Database field, enter the database name. The system will automatically add your account prefix.

For example: yourwebsitege_db

2. Create a User

In the Database User field, enter the username. Create a strong password or use the generator.

For example: yourwebsitege_dbuser

Access Type

  1. Local (this server only) — standard and recommended
  2. Remote — only if you plan to connect from an external server

Automatic Access Assignment

In the form, the option “Grant user access to database” is already selected.

This means that after clicking Submit, the system will automatically:

  1. Create the database
  2. Create the user
  3. Link the user to the database
  4. Assign the necessary privileges

No manual linking is required.



After completion:

In Existing Databases, you will see:


yourwebsitege_db


In Assigned Users, you will see:

yourwebsitege_dbuser@localhost

This means everything has been configured correctly.



Using phpMyAdmin

To manage your database:

  1. Go back to the Databases section
  2. Click on phpMyAdmin




phpMyAdmin allows you to:

  1. Create tables
  2. Insert data
  3. Run SQL queries
  4. Export the database (backup)
  5. Import a database (upload a .sql file)
  6. Optimize tables

If the database is new, you will see the message: “No tables found in database.”

This is normal — tables will be created automatically when you install a CMS (for example, WordPress).



Using the Database in Your Website

In your website configuration (e.g., wp-config.php), you will need:

  1. Database Name
  2. Database User
  3. Database Password
  4. Database Host (usually: localhost)

Example:


define('DB_NAME', 'yourwebsitege_db');
define('DB_USER', 'yourwebsitege_dbuser');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');


Important Recommendations

  1. Always use a strong password
  2. Store your password securely
  3. Do not share database access with third parties
  4. If you do not plan to use remote connections, keep Access Type: Local

Common Issues

If your website shows:

“Error establishing a database connection”

Check the following:

  1. Whether the database name is correct
  2. Whether the user is properly assigned to the database
  3. Whether the password is correct
  4. Whether DB_HOST is set to localhost

A MySQL database is a core component of your dynamic website. Proper creation and configuration are essential for stable website performance.




Was this article helpful?