Creating a MySQL database in cPanel is a key step when setting up web applications that require a database, such as content management systems (CMS) like WordPress, or custom-built applications. cPanel provides a user-friendly interface for managing databases, making it simple to create and configure new MySQL databases, users, and permissions.
A MySQL database is used to store and manage data for your website or application. Before installing any web application that relies on a database, you need to create both the database and a database user with the appropriate permissions. In cPanel, this process is straightforward and can be done in a few steps using the MySQL Database Wizard or the MySQL Databases tool.
Ensure you name your database and user appropriately, and grant the correct permissions to the user. Secure handling of database credentials is important to protect sensitive data from unauthorized access.
Steps to create a MySQL database in cPanel:
- Log in to your cPanel account.
- Navigate to the Databases section.
- Click on MySQL Databases.
The MySQL Databases tool lets you create databases, manage users, and assign permissions.
- In the Create New Database field, enter the name of your new database.
- Click Create Database to confirm.
Database names in cPanel typically follow a format like “user_dbname” where “user” is your cPanel username, and “dbname” is the database name you choose.
Example database name: user_mydatabase
- Scroll down to the MySQL Users section.
- In the Add New User field, create a new database user by entering a username and password.
- Click Create User.
Ensure that the password you choose is strong. cPanel provides a password generator to help you create secure passwords.
Example user: Username: user_mydbuser Password: **********
- Go to the Add User to Database section.
- Select the user you just created and the database you want to assign them to from the dropdown menus.
- Click Add to link the user to the database.
After adding the user, you will be prompted to assign privileges. You can grant all privileges if the user requires full control, or select specific permissions depending on the application’s needs.
- Assign the appropriate privileges to the user, and click Make Changes.
Common privileges include SELECT, INSERT, UPDATE, and DELETE. Full access may be needed for most web applications.
- Your database and user are now set up. Verify that they are working by connecting your web application or using a tool like phpMyAdmin to manage your database.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.