How do I use MySQL?

Using MySQL
A full guide can be found at http://www.cpanel.net/docs/cp/MySQL.htm

SQL stands for Structured Query Language. SQL is a international standard in querying and retrieving information from databases. mySQL is essentially an SQL server - it responds to requests for information that are written in SQL. You can communicate with mySQL using a wide variety of programming languages (PHP being one of the most common). mySQL is Open Source software and generally free for use.

Refer to the following links for more information about mySQL :

mySQL FAQ - a good place to start.

mySQL and PHP tutorial - a good introduction to using the two Open Source technologies together.

Creating a MySQL database

To create a mySQL database:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Enter the name of the database in the Db field.

3. Click on the Add Database button button. The database will be added to the /var/lib/mysql folder.

You need to create at least one database user and grant that user permission to use the new database. Refer to Creating a mySQL user and Grant a user's permissions to a mySQL database for more information.

Removing a MySQL database:

Removing a database will delete that database from it's online location. Be sure that you have saved a copy of the database if you want to keep any of the information in the database. Removing a database will not remove any user's but it will remove all user's permissions to that database.

To remove a database:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Click on the Delete button next to the specific database.

Creating a MySQL user

You need to create a mySQL user before that user is able to use the database. This does not automatically allow the user to use a database - you need to grant that user permissions to the specific database first. Refer to Grant a user's permissions to a mySQL database for more information.

To create a mySQL user:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Enter the user's name in the Username field and the user's password in the Password field.

3. Click on the Add User button button.

Removing a MySQL user

Removing a user deletes that user - it removes all database permissions that the user has and does not allow that user access to any mySQL databases.

To remove a user:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Click on the Delete button next to the specific user in the Users area.

Granting a user permissions to a MySQL database

Once you have created a user to use a database you need to grant that user permission to use the database. If you have not yet created a user, refer to Creating a mySQL user for more information.

To grant user permissions to a mySQL database:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Choose the specific user from the User drop-down list and the specific database to grant permissions to from the Db drop-down list.

3. Click on the Add User to Database button button. The user now has permission to use that database and sample connection strings are shown in the mySQL window.

Removing a user's permission

A user will no longer be able to access a particular database when you have removed their permissions to that database.

To remove a user's permissions:

1. Click on the SQL Database link in the Site Management Tools section of the main menu in the control panel.

2. Click on the Delete button next to the specific user underneath the name of the database in the Databases area.

Was this answer helpful?

 Print this Article

Also Read

How can I backup MySQL Databases?

 How can I backup MySQL Databases? Solution This can be used...

Powered by WHMCompleteSolution