MySQL Forums
Forum List  »  General

Re: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Posted by: Filipe Silva
Date: March 24, 2021 06:10AM

No problem, I can try to help you.

But I still don't understand what's the problem. You are able to connect using "mysql -u root -p" but not with "mysql" alone, is that so?

But, among other things, you are supposed to provide a username and a password to "mysql" tool. However, most options have defaults that work out of the box. This is not the case of option "--user" ("-u") or "--password" ("-p"), though.

You may also use option files that can override defaults for every single option. Please consult the documentation for details, specifically in the "[client]" section.

You can see what options you can put in the option files by consulting the documentation or by running "mysql --help".

If you want to know if your "mysql" command is already taking some default values from an option files (they can be placed in multiple places) just run "mysql --print-defaults".

So, if you want to be able to run "mysql" alone and not having to provide a user name and password then you'll have to create or edit one of these option files. Just mind that it is not safe to store user names and passwords in configuration files.

If this is not what you wanted to know, then please provide more details.

I hope this helps.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.