Home >> MySQL Databases

MySQL Databases

This document provides information about MySQL databases. Topics include creating databases, removing databases, adding users to a database, changing database passwords, and setting up your database with scripts. The control panel makes database management easy for those people who don't have in-depth knowledge of the topic.

Creating Databases

From the main control panel menu click the "MySQL Management" entry and then click the "Create new Database" link.

Choose a Database Name that helps you remember what the database is for. For example, enter "chat" if the database is intended to be used with a chat script. The database name is always preceded by your username and an underscore. If you chose "chat" for a name, the actual database name would be demo_user_chat.

The Database Username is the login name for the database. It may be the same as the Database Name. In the above example, we chose a different login name (gary). As with the Database Name, the Database Username is also preceded by your username and an underscore (demo_user_gary in this case).

After you have selected the database name and username, enter a database password and click the "Create" button.
This will bring up a confirmation page showing you the details of the newly created database.

Note that there is no way to retireve the mySQL database password, so you should make sure you write down the one listed in the confirmation page.

Removing Databases

After having created at least one database, a list of all databases will be displayed in the main "MySQL Management" page. To delete a database, check the box next to the database name you want to delete and then click the "Delete Selected" button.

Adding Users to a Database

There may be times when you want to have more than one login name and password assigned to a database. To add additional users to a database, follow these steps:

1. From the main database menu, click on the name of the database you want to modify.

2. Click on the "Create New Database User" link at the top of the screen.

3. Enter a username and password and then click the "Create" button.

You can see how many users each database has in the database list on the main MySQL databases menu.

Removing Users from a Database

To remove database users, first click on the database name from the main MySQL databases menu. In this example we have clicked on the "demo_user_chat" database, which has two users (see above picture).

The demo_user_chat database has two users: demo)user_chat (the username is the same as the database name) and demo_user_gary2. To delete a database user, simply check the box next to its name and click the "Delete Selected" button.

Changing Database Passwords

To change a database password, first click on the name of the database in the main MySQL databases menu. The list of database users will appear (see above picture). To change the password for the database user, click the "modify password" link and enter a new password, then click the "Create" button.

You do not need to know the old password to make this change.

Changing Database Privileges

With MySQL, different privileges can be assigned to individual users. Although this can be accomplished using phpMyAdmin, it can also easily be accomplished using the Control Panel.

To check or change privileges of a specific user, from the main "MySQL Management" page click on the database name to bring up a list of users then click on the "modify privileges" link corresponding to the user being worked on. The following panel will be displayed.

Change any settings as required and click save.

Adding MySQL access for remote hosts

By default, each database is configured to be accessible only from the localhost (i.e. the webserver itself).

Additional remote hosts can however be configured to allow remote management and manipulation of the database.

To create additional hosts click on the database name in the main "MySQL Management" page.

Enter the IP address of the host needing remote access to the MySQL and click "Add Host". This will enable access from the specified host by any user listed in the panel above.

Deleting MySQL access for remote hosts

To remove access for a remote host no longer being used, simply place a check mark next to the host and click on the "Delete Selected" button.

Setting up your Database with Scripts

Most scripts need to know four things about your database: the database name, database username, password, and hostname.

The database name always takes the form as ControlPanelUsername_DatabaseName, where ControlPanelUsername is the sign in name you use to access the control panel. The DatabaseName is the name you give to the database from the MySQL databases menu. For example, if you sign into the control panel as "gary" and create a database named "count," the true database name is gary_count -- you will want to enter this database name into your script configuration.

The database username can be the same as the database name or you may choose a different username for the database. The database username takes the form of ControlPanelUsername_DatabaseUserName.

The database password is set during database creation. The password should be different than your control panel password. The script will need to know the database password in order to modify the database.

The hostname tells the script where to access the database. Usually this is designated as 'localhost' because the script and database are located on the same server. If the script doesn't allow a text entry in the hostname configuration, enter the IP address of your site.

Note: After you create a database, the control panel will take you to a screen that gives you all this information. Simply take the values from this page and enter them into your script configuration.

Accessing phpMyAdmin

phpMyAdmin is a tool written in PHP that allows you to administrate your MySQL databases. You can execute SQL statements, work with fields (add, edit, delete), work with tables (create, alter, drop), create additional databases, and much more. phpMyAdmin is intended for advanced users. Most PHP scripts will automatically setup the database for you, so you probably won't need to use phpMyAdmin..

phpMyAdmin can be accessed at http://www.yourdomain.com/phpMyAdmin. Please visit http://www.phpmyadmin.net for more information on using phpMyAdmin.

Need more help?

If you need further assistance with any Control Panel feature, please contact our Customer Support department.
Helpful information is also available in the DirectAdmin support forums.

Seanet Control Panel Help