This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes using MySql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "using MySql" Watch "using MySql" New topic
Author

using MySql

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Hi all,

I have developed an EJB application that accesses the database MySql that is shipped with the Glass fish server Sun Java System Application Server 9.1_01. The MySql database is running on port 3036. The database connection properties are mentioned in persistence.xml as:



But I get this exception when I run the client:



Can any one please help me in creating some user using the mysql> command line utility.


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3833

Niranjan Deshpande wrote:Can any one please help me in creating some user using the mysql> command line utility.


Go to your mysql installation and change to bin folder from command prompt. Then issue this command,
mysql -uroot

(Normally root account comes with no password). Once you logged in you can create user accounts. Check this.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Hi

I followed the steps that you mentioned.

When I do execute the command create user admin adminadmin at the mysql> prompt this is what I get, just a

->_

The cursor moves on the second line.

How do I know the command is executed? Any key to execute the command?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3833

If your query is complete then it should end with ";" (colon), then it'll be executed.
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Thanks for the ; thing! But now I am getting this:

Renjith Mohan
Ranch Hand

Joined: Nov 28, 2008
Posts: 65

Please check if you have left out any white spaces in the password.

Also, grant privileges on mysql server using the command

GRANT ALL ON *.* TO username@host; // run the command after logging into mysql prompt


Renjith
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
There are now white spaces

I even used the command create user admin identified by adminadmin

What the hell is wrong!
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
I finally used the root user

1.C:\Sun\AppServer\mysql\bin>mysqladmin -u root password root.

I referred this link for setting the password

2.C:\Sun\AppServer\mysql\bin>mysql -u root -p
Enter password: **** <- enter root here


Onnce I was able to pin down the user name and password, I changed the persistence.xml and successfully executed the application.

Thanks a lot for the help!
Renjith Mohan
Ranch Hand

Joined: Nov 28, 2008
Posts: 65

All privileges are available if you are a root user.

Any way, good 2 know you solved
 
GeeCON Prague 2014
 
subject: using MySql