Search code examples
mysqlcmdpathpasswordsroot

Need to access SQL using "mysql root -p"


Hey guys: I have one question access mysql using command line. I have no problem to access mysql based on this commend line "mysql --host=localhost --user=root --password="mypassword""; however, I have issue access mysql using the conventional way: "mysql root -p". I've tried many times to change root password. But I still only can access mysql using this commend line "mysql --host=localhost --user=root --password="mypassword"". Any comments are welcoming!


Solution

  • You have incorrect command as conventional way.

    The error you mentioned in comment indicates that MySQL username is "ODBC" & you are not passing proper MySQL user in the command line. That is happening because you are using "mysql root -p".

    Correct command is "mysql -u root -p". You missed the "-u " part.