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?

Did you tried this?

mysql -uCHRIS -pCHRISSEC

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.

Ok, great!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.