maspai
maspai

Reputation: 435

mysql command line: How to make mysql to prompt for username and password?

To run mysql command line providing a username is:

mysql -uUSERNAME ...

But how to make the command to prompt/ask for username, so I can omit -uUSERNAME parameter?

Upvotes: 4

Views: 2029

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562563

MySQL clients do not prompt for username. If you don't specify a username, it defaults to your shell user (on UNIX/Linux) or 'ODBC' (on Windows). So it says in https://dev.mysql.com/doc/refman/8.0/en/connecting.html

If you want to omit the user option or the password option, use an options file. See https://dev.mysql.com/doc/refman/8.0/en/option-files.html

Upvotes: 1

Related Questions