When uploading a dynamic website, skills in creating a database and adding a user to the database are required. Different web applications have different syntaxes for connecting to the database, but the way to create the database remains the same. In this guide, we will cover how to create MySQL database, create a user and add the user to this database.
Requirements: Access to a panel
Method 1: How to create MySQL database and add a user using the MySQL Database wizard
Login to your Cpanel and search for MySQL database wizard from the search field.
Give your database a name. Note that your Cpanel username serves as the database name prefix. Then click Next.
Enter your preferred database username and password. Confirm the password and click on the Create user button. Ensure to note down the database credentials.
Click on All privileges check box to give the user the privileges of running the different tasks on the database and click on the Next Step button.
You have successfully created a database and a database user! You can now use the credentials to configure your web application.
Method 2: How to create MySQL database and a user on Cpanel the long way
Login to your Cpanel and search for Mysql database.
Enter your preferred database name and click on the Create database button as shown in the image below.
Scroll to the MySQL users:: Add new user section. Enter your preferred username and password and click on create user button.
How to add a user to MySQL database on Cpanel
Once a database is created, and a user is created, it’s time to add the user to the database. Just below the add new user section, scroll to Add User To Database section; still under the Mysql database page.
Select the user you wish to add to the database, and the database from the drop-down, and click add.
Click on the All privileges button to give the new user all the database privileges and click on make changes.
Once done, the user is added to the referenced database and given all privileges.
How to reset a database user password in Cpanel
Having created a database, and added a user, you may forget the user password which is an entry required when connecting your website to a database. To reset a database user password, search for MySQL Databases from your Cpanel and click on the option.
Scroll to the bottom of this page, where a user list has been created. Next to the user, you intend to change the password for, click on Change password.
Enter the new password and click on change password, to update the new password.
The described process should be as simple as illustrated. Should you face some challenges, reach out to us, by posting as a comment, or contacting us for assistance.
Web Hosting and email hosting Packages
Related content
- A Practical Tutorial for Dockerizing Software Applications
- How to Configure a Docker App to a Domain Name
- Getting Started with Docker | Docker commands
- How To Run Scripts in Linux
- Deploy a Django Application on EC2 Instance with Nginx
- How to configure a domain to a docker container and install an SSL certificate on AWS