For example on Windows, you can set the user john
and the password banana
under [client]
in my.ini
as shown below. *My answer explains [client]
and my answer explains where my.ini
is located on Windows and my answer explains how to log in by setting only the password banana
under [client]
in my.ini
:
# "my.ini"
[client]
user="john"
password="banana"
Then, you can log in by setting my.ini
's location to --defaults-file=
or --defaults-extra-file=
as shown below:
mysql --defaults-file='C:\ProgramData\MySQL\MySQL Server 8.0\my.ini'
Or:
mysql --defaults-extra-file='C:\ProgramData\MySQL\MySQL Server 8.0\my.ini'
*Not setting my.ini
's location to --defaults-file=
or --defaults-extra-file=
gets error as shown below:
mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
my.ini
file, it does work as expected? And do you have a mysql user login who doesn't need a password or has an empty password? – Glowingroot
with empty password. If I have to change password in database, then for what are ini file? – Lederermy.ini
file with the[client]
section is for? – Glowingmy.ini
file with the[client]
section is for. – Lederer