On Linux, my.cnf can be altered such that mysql -u myusername will work on the client side without the -p option. It's safer to use config files to set this up rather than putting the password in at the login line, and it's more convenient (though perhaps less safe) than putting the password in at the default -p prompt. But I have yet been able to find a guide on altering the my.ini file to achieve this result. For reference, I have been using: https://dev.mysql.com/doc/refman/5.7/en/option-files.html (my version is 5.7). I also have read the my.ini file. The language used is too ambiguous and technical for me to understand so I hope to find or eventually compose a real guide.
According to my research:
my.cnfalso works.- mysql will search for .cnf files at the locations specified in the
mysqldvlhelp.txtfile (which does not exist on Windows).
In your my.ini, you can create a client section to put the user and password.