Difference between revisions of "Creating New Databases and Tables with MySQL Administrator"

From Techotopia
Jump to: navigation, search
(Creating a New Database)
(Creating a New Database)
Line 12: Line 12:
  
 
The columns in the table may be viewed and modified by selecting the desired table in the list and clicking the ''Edit Table'' button.
 
The columns in the table may be viewed and modified by selecting the desired table in the list and clicking the ''Edit Table'' button.
 +
 +
In order to create a new database, simply move the mouse pointer to any area of the ''Schemata'' list, click with the right hand mouse button and select ''Create Schemata'' from the popup menu. In the resulting ''Create Schema'' dialog, enter a name the new database. For the purposes of this tutorial we will use the name ''myDBase''. Click on ''OK'' to initiate the schema creation.
 +
 +
If the new database is not currently selected in the ''Schemata'' list, select it and note that the view area now changes and shows no tables. The next task, therefore, is to create a table in our new database.
 +
 +
== Creating New Tables ==

Revision as of 19:28, 27 September 2007

Unless a database already exists, very little can be done with MySQL until a database with at least one table has been created. Databases and tables can either be created using SQL commands (typically using the mysql tool) or using a grpahical administration tool such as MySQL Administrator. In this chapter we will cover the creation of databases and tables using MySQL Administrator. If you prefer to use SQL commands to perform these tasks refer to Creating Databases and Tables Using SQL Commands.

This chapter assumes you have an understanding of databases, tables and columns and have the MySQL Administrator installed, running and connected to a database server (see The MySQL Administrator Tool for details).

Creating a New Database

Once MySQL Administrator is running and connected to a database server, the first task is to create a new database. Begin by clicking on the Catalog option on the left hand side of the MySQL Administrator main window. The Catalog screen will then appear as follows:

Mysql admin catalog.jpg

The area in the bottom left hand corner of the screen entitled Schemata lists the databases currently under the control of the database server to which the administration client is currently connected. Selecting any existing entry in this list will list the tables contained within that database. In the above figure, a pre-existing database named PHPsampleDB is selected, which is shown to contain a single table named customer which contains 5 columns.

The columns in the table may be viewed and modified by selecting the desired table in the list and clicking the Edit Table button.

In order to create a new database, simply move the mouse pointer to any area of the Schemata list, click with the right hand mouse button and select Create Schemata from the popup menu. In the resulting Create Schema dialog, enter a name the new database. For the purposes of this tutorial we will use the name myDBase. Click on OK to initiate the schema creation.

If the new database is not currently selected in the Schemata list, select it and note that the view area now changes and shows no tables. The next task, therefore, is to create a table in our new database.

Creating New Tables