Setup MySQL Database

In this section we will create database and table into MySQL database.

Setup MySQL Database

Setup MySQL Database

        

In this section we will create database and table into MySQL database. Table created here will be used in sample application.

Downloading and Installing MySQL

You can download MySQL from mysql.org. Read more on downloading and installing mysql at http://www.roseindia.net/mysql/mysql5/Installing-MySQL-on-Windows.shtml

Creating Database :

You can create mysql database by issuing the following command:

>mysql>create database jsf_hibenate;

Creating Table :

To create table in this database you would have to first select the database by use statement.

mysql>use jsf_hibenate

Now, you can create table using the following command :

mysql>create table users ( 
userId int(11) NOT NULL auto_increment, 
userName varchar(20) default NULL, 
userPassword varchar(11) default NULL, 
userEmail varchar(30) default NULL, 
userAddress varchar(30) default NULL, 
PRIMARY KEY (userId) 
) ;