MySQL Forums
Forum List  »  Newbie

Re: Not understanding the simplest security scenario
Posted by: jon gore
Date: March 06, 2023 11:44PM

The reason why the first command worked while the second one failed is because the syntax of the second command is incorrect. When using the -u option, you should specify only the username and not include the hostname. Therefore, the correct syntax should be:

Copy code
mysql -u root -h localhost
This will connect to the MySQL server as the root user and specify the host as "localhost".

In the first command, you did not specify a hostname, so it defaults to the local host which is also "localhost". The command is equivalent to:

Copy code
mysql -u root -h localhost
This is why it worked without any issues.

Options: ReplyQuote


Subject
Written By
Posted
Re: Not understanding the simplest security scenario
March 06, 2023 11:44PM


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.