JDBC Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 2.11

Creating Database and User with MySQL Monitor

This section describes how to create a new database and a new user with MySQL monitor.

MySQL server organizes database objects into databases. In order to test JDBC driver for MySQL server, I created a new database called, HerongDB, and a new user, Herong, with the MySQL command line interface:

C:\>\local\mysql\bin\mysql -u root

mysql> CREATE DATABASE HerongDB;
Query OK, 1 row affected (0.03 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| herongdb           |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> CREATE USER Herong IDENTIFIED BY 'TopSecret';
Query OK, 0 rows affected (2.75 sec)

mysql> GRANT ALL ON HerongDB.* TO Herong;
Query OK, 0 rows affected (0.34 sec)

Now I am ready to login to the MySQL server with "Herong" and use "HerongDB" through Java JDBC interface.

Sections in This Chapter

MySQL 5.0 Download, Installation and Start

mysqladmin - MySQL Admin Tool

mysql - Command Line Tool

Creating Database and User with MySQL Monitor

Dr. Herong Yang, updated in 2007
Creating Database and User with MySQL Monitor