Database Administration

Now that your server is running 24 hours a day, 7 days a week, your next task is to get it to serve your database needs. mSQL provides a set of utilities that support easy server administration.

The msqladmin Utility

The msqladmin utility is your primary database administration tool. It supports creating, deleting, copying, renaming, and examining your mSQL databases. If you look back to our discussion of what a database is in Chapter 1, you will remember that mSQL itself is not a database. Your databases are the collection of files under each directory in the msqldb directory. mSQL is the database engine. One engine can serve many databases simultaneously. The msqladmin utility lets you administer the databases under a particular server.

Database creation

The first thing you want to do with your new mSQL installation is create a database that serves some purpose for you. The syntax of creating a database is:

msqladmin create DATABASENAME

In this syntax, DATABASENAME is the name of the new database you wish to create. This command will create a new, blank database with the name you specify. As we mentioned earlier, a database in mSQL is simply a directory under the msqldb directory in the mSQL installation. mSQL places all the data associated with your new database in files underneath this directory. For example, if you create a database called “mydata” using a default mSQL installation, the directory /usr/local/Hughes/msqldb/mydata will appear.

Database destruction ...

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.