MySQL helps you in managing your website’s data and in this tutorial, we’ll make MySQL create database and user on any hosting. MySQL is one of the most popular and most used database management systems. Since MySQL is open source, free and widely known to many developers, most CMS (Content Management System) chose this over others.
MySQL basically manages your website’s data in a way that you can access it anytime and in any way you like. Most of your data is managed in different tables, rows and columns which is easy to manage and find when a visitor wants it. Since every visitor wants the website to load fast and content to be served quick, thus a managed database is very necessary.
How to create MySQL database and User
When you are using a cPanel then, its very easy to create MySQL database and user on any hosting. I’ll guide you through all the ways and you can pick anyone which you think is the best for you.
Creating MySQL database
- Login to cPanel and then open MySQL databases.
- In “Create New Database” type the name for your database. I’ll usually have a prefix already written and your name will become a suffix for that. So the whole name with the suffix will be the database name.
- Click on “Create Database” and your database is ready to be used. It’s as simple as that.
- If you want to check your database that it doesn’t have any issue then you can use go to “Modify Databases” section. There you have to select the database you want to check and then click “Check Database”. It’ll run a few tests and will tell you if your database is good or not. If your database is good then it’s ok but, if it does not then follow the next step.
- If your database is not good then in “Modify Database” section go to Repair Database. Select the database which you want to fix and click on “Repair Database”. It’ll run a few queries and that should fix your database problems right away.
- If you have written your database name wrong and want to edit it then, go to “Current Databases‘’ section. There look for the database which you want to edit, once you locate that click on “Rename” in front of it. There you can correct the name and save it.
- If you want to delete a database then also go to the “Current Databases” section and locate the database. Once you find the database you want to delete, click on delete in front of it. It’ll ask for your confirmation, give it the permission and that database will be deleted.
That is how you can make MySQL create a new database and also perform various other tasks with a database. Following these easy steps is all that you need to do and everything will be set for you. After this, you need to assign a user to your database and for that, you need to create a user. Follow this article to learn how to create a user for your MySQL database.
Creating a user for MySQL database
- Login cPanel and then open MySQL databases just like above.
- Go to “MySQL Users” / “Add New User” and fill the username field with the name of the user. It might have a prefix already written and your name will act as a suffix. So the complete name will become the username.
- Then type in the password and confirm it by typing it again. You can also user Password Generator to generate a good password. (If you use Password Generator then, copy that password somewhere safe so that you can easily find it but no one else)
- Finally, click on “Create User” and the user will be created.
- Now if you want to add that user to a specific database then go to “Add User To Database” section. Select the user in the user column and database in a database column and press “Add” button. It’ll ask and show the permission you want to grant that user for that database. You can select all permissions or be specific if you like. Finally, proceed with the changes you have made and your user is added to the database.
- In case you want to edit the password for the user you created then go to “Current Users” section. Locate the user for which you want to change the password and click Change Password. There you’ll have to type your new password twice to confirm it and finally click on “Change Password”.
- If you want to edit the name of the user then also you have to go to “Current Users” section and locate that user. Then click on Rename in front of that user and there you can change the name of that user.
- If you want to delete a user then also you have to go to “Current Users” section and locate that user. Then click on Delete in front of that user, it’ll ask for your confirmation. Proceed with it if you want to delete that user and that user will be deleted.
- If you want to delete a user from a specific database then go to “Current Databases” section and locate the database. Then click on the user’s name in front of that database. It’ll ask for your confirmation to delete that, once you confirm that, the user will be deleted from that database.
That’s how you can create a user for MySQL database in any hosting using cPanel. The steps are simple and you can follow them from word to word.
Also read: How to install WordPress in cPanel
Following the simple steps is what you need to do to create MySQL database and user on any hosting. With the introduction of cPanel, the creation of databases and other functions related to it have got very easy. The other way you can create MySQL databases and users is through phpMyAdmin but that topic is for other time. With this tutorial, it’s very easy for anyone to get this website up and running in no time at all.