JDBC for MySQL - Herong's Tutorial Examples - v3.13, by Herong Yang
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:
herong> mysql -u root -p ... mysql> CREATE DATABASE HerongDB; Query OK, 1 row affected (0.03 sec) mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | herongdb | | mysql | | performance_schema | | test | +--------------------+ 5 rows in set (0.00 sec) mysql> CREATE USER 'Herong'@'localhost' IDENTIFIED BY 'TopSecret'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON HerongDB.* TO 'Herong'@'localhost'; Query OK, 0 rows affected (0.00 sec)
Now I am ready to login to the MySQL server with "Herong" and use "HerongDB" through Java JDBC interface.
In newer versions of MySQL, you need provide both user name and host name when specifying a user in the format of 'user_name'@'host_name'. In older versions of MySQL, the host name part is not required. For example, you can create a user using "CREATE USER Herong IDENTIFIED BY 'TopSecret'" command.
Table of Contents
JDBC (Java Database Connectivity) Introduction
►MySQL Installation on Windows
►Creating Database and User with MySQL Monitor
MySQL JDBC Driver (MySQL Connector/J)
MySQL - Reference Implementation of JdbcRowSet
MySQL - JBDC CallableStatement
MySQL CLOB (Character Large Object) - TEXT
MySQL BLOB (Binary Large Object) - BLOB