3.2 Database Creation

only for RuBoard - do not distribute or recompile

3.2 Database Creation

To get started using MySQL, you need to create a database. First, let's take a look at the databases that come with a clean MySQL installation using the SHOW DATABASES command. Upon installation of MySQL 3.23.40, the following tables already exist:

 mysql>  SHOW DATABASES;  +----------+  Database  +----------+  mysql      test      +----------+ 2 rows in set (0.37 sec) 

The first database, mysql , is MySQL's system database, which you will learn more about in Chapter 5. The second database, test , is a play database you can use to learn MySQL and run tests against. You may find other databases on your server if you are not dealing with a clean installation. For now, however, we want to create a new database to illustrate the use of the MySQL CREATE statement:

 CREATE DATABASE TEMPDB; 

and then to work with the new database TEMPDB :

 USE TEMPDB; 

Finally, you can delete that database by issuing the DROP DATABASE command:

 DROP DATABASE TEMPDB; 

You can create new objects using the CREATE statement and destroy things using the DROP statement, just as we used them here.

only for RuBoard - do not distribute or recompile


Managing and Using MySQL
Managing and Using MySQL (2nd Edition)
ISBN: 0596002114
EAN: 2147483647
Year: 2002
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net