Login to MySQL

In this tutorial, we will learn how ot

Do you have a username and password to MySQL server running on your local machine and wondering how to login to the server? Here you go.

Open Command Prompt and navigate to the bin location of MySQL Server.

Windows - Navigate to MySQL Server bin location in Command Prompt

MySQL Server x.0\bin contains mysql.exe. The executable can accept username and the mention of password as optional arguments.

Run the following command, in the command prompt with yourusername replaced with the username you have to the MySQL Server.

C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u yourusername -p
ADVERTISEMENT
MySQL Server Login - Prompt for password

Now, you have to enter the password. The password is not echoed back to the prompt, but stars. This is for security and protecting your password from social engineering.

Press enter key after typing your password.

If your login is successful, mysql command line is opened.

MySQL Command Line Interface

If your login and password do not match with the users in the MySQL server, following message is displayed in the Command Prompt.

MySQL Access denied for user with wrong password