Creating, Dropping, and Selecting a Database

Now that you have seen how to use MySQL's basic client tools, it's time to start putting them to use. You will first use them as you learn how to create a database and then go on to do other kinds of database manipulation.

Creating and dropping a database is something that you may seldom do, except during the design phase of a project, yet the ways of doing these things are important for you to grasp. As you will see, there are often two or more ways to do the same thing, so you will learn both the SQL and the client-driven ways to manipulate databases.

Creating a Database

To create a database from a Unix console, use the mysqladmin command with the following format:

mysqladmin create database_name ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition 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.