Deitel & Associates, Inc. Logo

Back to www.deitel.com
digg.png delicious.png blinkit.png furl.png
Java How to Program, 6/e

ISBN:
0-13-148398-6
© 2005
pages: 1576
Buy the Book!
Amazon logo
InformIT logo

[Notes: This is an excerpt (Section 25.6) of Chapter 25, Accessing Databases with JDBC, from our best-selling textbook Java How to Program, 6/e. This tutorial may refer to other chapters or sections of the book that are not included here. When you purchase this book you also get free access to the Web-based Java Multimedia Cyber Classroom, 6/e, for six months. The Cyber Classroom includes audio descriptions of the examples in Chapters 1-14, solutions to approximately one-half of the end-of-chapter exercises, interactive true/false self-assessment questions and a searchable Web-based e-book. Permission Information: Deitel, Harvey M. and Paul J., JAVA HOW TO PROGRAM, ©2005, pp. 1206-1207. Electronically reproduced by permission of Pearson Education, Inc., Upper Saddle River, New Jersey.]

 

Java RowSet Tutorial, Setup Part 2: Instructions on Setting MySQL User Account

For the JDBC examples in this book to execute correctly, you need to set up a user account that allows users to create, delete and modify a database. After MySQL is installed, follow the steps below to set up a user account (these steps assume MySQL is installed in its default installation directory):

1. Open a Command Prompt and start the database server by executing the C:\mysql\bin\mysqld script.

2. Open another Command Prompt and change to the C:\mysql\bin directory. To start the MySQL monitor so you can set up a user account, execute the command

C:\mysql\bin>mysql -h localhost -u root
3. For our examples, we set up a user account on the local computer (localhost) with the username set "jhtp6" and the password "jhtp6". To do this, execute the following commands in the Command Prompt created in Step 2:
mysql> USE mysql;
mysql> INSERT INTO user SET Host='localhost', User='jhtp6',
Password=PASSWORD('jhtp6'), Select_priv='Y',
Insert_priv='Y', Update_priv='Y', Delete_priv='Y',
Create_priv='Y', Drop_priv='Y', References_priv='Y',
Execute_priv='Y';
mysql> FLUSH PRIVILEGES;
mysql> exit;

Setup for RowSets Example:
Java RowSet Tutorial, Setup Part 1: Instructions to install MySQL and MySQL Connector/J
Java RowSet Tutorial, Setup Part 2: Instructions on Setting MySQL User Account (You are here)
Java RowSet Tutorial, Setup Part 3: Creating Database books in MySQL

Java RowSet Tutorial: RowSet Interface

Tutorial Index