Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using MySql

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your query is complete then it should end with ";" (colon), then it'll be executed.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the ; thing! But now I am getting this:

 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All privileges are available if you are a root user.

Any way, good 2 know you solved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic