The problem is I have made a second user account for my databases, every time I open the MySql monitor it doesn't prompt me for a username, it just assumes I want to log into the Root and asks for my Root password. It doesnt ask for a username or which username I want to log in under.

I assumed that when I opened the mysql monitor it should prompt me to enter something like:

mysql -u username -p

but it just goes directly to my root, no username questions.

This is just a localhost install of mysql on my PC.

Thanks for any help.


9 Years
Discussion Span
Last Post by verruckt24

How do you enter the MySQL shell/monitor ?
If you type just mysql and fire the command it will assume the default settings in the my.cnf (GNU Linux)/ my.ini (Windows) configuration file.

If there's something different that you are doing then specify it.


Hi verruckt24,

Thanks for trying to help. I must not have explained properly.

I was setting up user names and passwords for the MySQL database to give those usernames certain access to parts of the database.

I'm trying to figure out how to login to those new usernames. Because when I open the mysql monitor it goes right to the Root user, it doesnt ask me to sign in, it only prompts me for the Root password. It should be asking which username wants to log in.

Is that clearer? Thanks for your help.



MySQL monitor - this is the command shell of MySQL that you are talking about isn't it ? Just to make sure we are on the same wavelength here.

Also have you already created the users or are you in the process of creating them.

Third, what command do you use to login ?

The actual procedure should be something like:
1. Login using the root user
2. Create users with 'Create user...' or 'Grant'
3. Logout of the shell.
4. Try to login with the given username/password.


Yes, the MySQL monitor is what I'm talking about.

Yes, I have created the user already and gave that user account privileges to a certain database.

For the third question you asked about how I login: I just open the MySQL monitor and it instantly prompts me for the root password. I enter it and I'm in.

Your procedure that you gave was very helpful. So I guess I understand my problem now of why it's not prompting a user name first.

No matter what I have to give that user access to the Root password? and then that user has to log in to his user name right?

I thought the point of creating user accounts was so that they can't access everything in the root, I only want them to be accessing what I give them privileges too. By giving them the root password so they can log in to their user account, doesn't that give them access to everything before they log in to their user account?

This is very confusing, or I'm making harder than it is haha. Thanks for your help.



Same passwords would not cause the root privileges to be given to the user. As privileges are given to user accounts and not to passwords.

2. Create users with 'Create user...' or 'Grant'

You can give the user account a password at the time of creating the user account. Read the CREATE USER syntax in MySQL documentation (MySQL Reference Manual) Or you could set the password with SET PASSWORD Read this in the documentation too. Or you could set the password with the GRANT command itself the command should be like this

GRANT SELECT, UPDATE, DELETE on database.tablename to user@host IDENTIFIED by 'password';

database - database on which to give permission to.
tablename - tablename on which to give permission to.
user - username
host - machine (localhost, domain-name or IP)
password - password that you want toassign to the user account.

Replace these values in the command as per your requirements. Read the GRANT command too in the docs.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.