How do I connect to and use MySQL?

To create and connect to a database in cPanel, you can follow these steps:

1. Log in to your cPanel hosting account.

2. Look for the "Databases" section and click on "MySQL Databases" or a similar option.

3. In the "Create New Database" section, enter a name for your database and click on the "Create Database" button.

4. Next, you need to create a user for the database. Scroll down to the "MySQL Users" section, enter a username and password, and click on the "Create User" button.

5. After creating the user, scroll down to the "Add User to Database" section. Select the user you just created and the database you created earlier from the respective drop-down menus, and click on the "Add" or "Submit" button.

6. On the next page, you will see privileges settings. Select the privileges you want to grant the user for the database, or you can select "All Privileges" to provide full access. Then click on "Make Changes" or "Add Privileges."

Your database is now created, and the user is connected to it. To connect to the database from your application, you generally need the following details:

- Database Name (e.g., yourdatabase)
- Database Username (e.g., youruser)
- Database Password
- Database Host (usually "localhost" or provided by your hosting provider)

Using these details, you can update your application's configuration or scripts to establish a connection to the database.


You can use the "PhPMyAdmin" in the cpanel account to browse, modify, download and upload your sql code.

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

What is MySQL?

MySQL is a very robust database server. It is often used to deliver dynamic content to sites such...

Can I connect remotely to MySQL database?

Yes! it is possible. For this you have to allow remote access from your control panel, by adding...

How can I backup and restore my MySQL databases?

There are two main ways to back up or restore a MySQL database on our servers: via SSH or the...

How do I create/delete/edit my databases and users?

All administration of your MySQL databases and users can be done through our convenient web based...

Can I import csv files using Load Data Infile?

This feature is not supported by cpanel but you can ask support to add File_priv to your db user...