954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to login in MySQL with newly created username and password?

Hi, I installed MySQL from the MySQL site. The setup procedure required me to set an username and password, which I set as X and Y respectively (say). Then when I opened the mySQL command line client, it asked for password, and after providing Y, I was allowed in. Once in I created a new user with a password with this command:

CREATE USER 'CHRIS'@'localhost' IDENTIFIED BY 'CHRISSEC';


set up a database and populated it with tables ad values, and granted the user CHRIS selected privileges using the command:

GRANT SELECT
ON PLAYERS
TO CHRIS;


and then I logged out. However, next time when I tried to login, the password "CHRISSEC" didn't work, and I had to use the old password "Y" to login. Also two different users may have the same password, so just asking the password alone cannot let the database know which user is actually trying to log in. So how to make the database prompt with a required username and password, upon which only those privileges granted to him before will be available to him and nothing else?

Cupidvogel
Newbie Poster
22 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

Did you tried this?

mysql -uCHRIS -pCHRISSEC
cereal
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

Yeah yeah, I did and now it is working fine. There were some problems with the installation, that's why it wasn't working. Thanks.

Cupidvogel
Newbie Poster
22 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

Ok, great!

cereal
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: