Managing MySQL Database

Our SiteManager includes a complete administration interface for managing your MySQL database. To access it, go to Database server menu and click on manage for the database you want to manage.

Alternatively you can also manage your MySQL databases using the more familiar command line tools.

Managing MySQL Database Using Command Line

To manually manage your MySQL databases, you need to log on to your shell account. Please see the section called “Logging in to UNIX Shell Account” for more information about logging on to your shell account.

Inside shell account, you can use the standard MySQL command line client to manage your database. If your database name is u777_database and the password is PASSWORD, you can connect to the database by issuing the following command.

mysql -uu777_database -pPASSWORD  u777_database

Inside MySQL shell, you can issue any SQL command to the database server. Please consult MySQL documentation for more information.

Note

Due to security concerns, our database servers do not allow LOAD DATA or any SQL commands that accesses filesystem directly.

Managing MySQL Database Using Alternative Software

While we provide a way to easily manage your MySQL Database, you may opt to use third party tools. There are basically two class of MySQL management software: web based application that might need to be installed on the server, and client based application that must be installed on user's computer.

The first class of MySQL management software need to be installed on your account, just like other regular web based application. One popular software of this class is phpMyAdmin. To configure these kinds of management software, follow the instruction in the section called “Using MySQL Database in Your Application”.

Important

There are several administration task that can't be done from third party management software. For example, you can't use them to create database.

The second class of management software are basically regular client application that must be installed on your computer. These software do their work by remotely connecting to MySQL database on our server. You need to supply several information to the software before it will be able to work correctly:

  • Hostname: primary-ip.example.com, assuming your domain name is example.com

  • Database name: specify the name of database you want to connect to. For example: u777_database

  • Username: the name of database, the same as your database name above.

  • Password: the password of this database that set from SiteManager

Creating new Table

Tables can be created by using Create New Table menu. To create a table, please follow these steps.

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to create. From there click on Create New Table.

  3. On the first screen you need to enter the table name, the table type and an optional comment. Table type can be MyISAM, ISAM or BerkeleyDB. The difference of each table types is described at MySQL manual. Click Next to continue.

  4. On the next screen you need to specify the name and type of the first field of the table. You can add more fields later in the following menu. Click Next to continue.

  5. On the next screen you will see your current information about the table you want to create. At this point the table is not created yet. You can add or remove more fields and indexes. The interface should be self explanatory.

  6. When done designing table, choose Finished, create the table.

Modifying Table Structures

You can also modify table structures after it has been created. You can add and remove fields and indexes. To modify table structure, please do the following steps.

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to create. From there click on edit structures for the table you want to modify.

  3. Follow the instruction on the next screen. You can change table type, create new field, modify or drop existing fields, create new index or drop existing index.

Caution

Changing table type might result in lost of certain table attributes. Please see MySQL documentation for more information.

Deleting/Dropping MySQL Table

To delete a MySQL table, please do the following:

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to create. From there click on drop for the table you want do delete.

  3. Confirm your action on the next screen.

Note

Tables that have been dropped cannot be recovered. Please be careful when dropping tables.

Modifying Records inside a MySQL Table

You can also add new records and modify existing records inside a MySQL table from SiteManager.

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to create. From there click on browse records for the table you want do edit its records.

  3. Inside the menu, you will be able to add new records or modify the existing ones. The interface should be self explanatory. You can change how the records are sorted by modifying the appropriate drop down boxes.

Note

You can't delete or edit records on a table without primary key.

Manually Entering SQL Query

You can also manually enter SQL queries from SiteManager. This allows you to perform more complex tasks by entering SQL queries directly into MySQL database. To manually enter SQL queries, you need to do the following.

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to enter queries into. From there click on SQL shell.

  3. Inside the menu, you will be able to perform SQL queries by typing SQL commands into the text area and clicking on Send Query. If you enter an SQL command that returns a result, the result in question will be displayed at the bottom of the page.

Tip

In this page there are tables and fields drop down boxes containing the currently created tables and fields in the current database. Clicking on the drop down box will input the value into the text area. There are also a history field containing previous SQL commands you performed before.

Note

Due to security concerns, our database servers do not allow LOAD DATA or any SQL commands that accesses filesystem directly.

Repairing and Optimizing MySQL Database

Sometimes database can get corrupted due to various reasons. You can attempt to fix your database by doing the following.

  1. Log on to SiteManager if you haven't already logged on.

  2. Go to Database Server menu and then click on manage for the database you want to repair. From there click on Check, repair, analyze and optimize all tables.

Copyright © 2003 indoglobal.com

. .