Login to MySQL from cmd on Linux

1 points
Asked by:

How can I connect with command line to MySQL on Linux?

1 answers
2 points
Answered by:

Quick solution, just enter: 

mysql -u root -p

It will ask you for password. In case you want to login on any other user, instead of 'root' use other user name.


If we want to enter password in the same line:

mysql -u root -proot

Parameter -p is connected with our password in this case the password is root.

When we use MySQL or MariaDB for tests on localhost or VM's we use root or admin as a password, for convenience when the security is not so importnat. 


0 comments Add comment
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.