Marven Malope
Marven Malope

Reputation: 3

MySQL Command Line Client on a local machine always asking for root user password and does give me a chance to log in as another user, on windows

I've installed MySQL (Community) and when run MySQL 8.0 Command Line Client, first thing it always asks me for a password for the root user, it does not give me a chance to log in as another user

When I run the command

mysql> exit

It simply shuts down the Command Line Client

Anyway I can fix this? enter image description here

When i installed MySQL i used the Full Setup Type, not sure if this info is hepfull I was able to use MySQL Shell to log in as another user other than the root user, so that the roundabout way of doing

AI recommeded editing my.ini file

[client]
username=your_username
password=your_passsword

I thought it would change the default user from root to another user

Did not work

Upvotes: 0

Views: 56

Answers (2)

Lajos Arpad
Lajos Arpad

Reputation: 77053

You can create a batch file (something.bat) that would contain

mysql -u youruser -p

which will use the user you wanted.

Upvotes: 0

David Marten
David Marten

Reputation: 151

See the docs here for connection options: https://dev.mysql.com/doc/refman/8.4/en/connection-options.html#option_general_host

If you are connecting to the instance from within the server you can use:

$ mysql -u your_username -p

Leaving the -p argument empty will prompt you for your password.

Avoid passing your password directly to the -p argument on the command line as it can be recorded in the shell history which is not secure.

Upvotes: 0

Related Questions