I have so far authored 5 courses on MySQL at Pluralsight, and one of the most popular question, I keep on getting is how to connect to MySQL with Command Prompt. You may find it funny enough that people who are learning MySQL would know how to connect to command prompt, but trust me, we all start from somewhere and we do not have to be an expert at everything. I respect every single question and I would like to answer this very question over here.
Step 1: Go to the folder where the MySQL exe file is located
For example, in my machine the location of the MySQL execution file is at “C:\Program Files\MySQL\MySQL Server 5.6\bin”. I changed the context of the command prompt to the folder where the MySQL exe file is located.
Step 2: Enter following commands in the command prompt
mysql -h nameofthehost -u username -p
In the above command, replace nameofthehost with actual host name and username with actual username. Now click on enter.
When clicked enter, it will ask for the password. Enter the password and click on enter.
It will connect you with MySQL Server.
Well – that’s it! You are connected to MySQL Server. Once you connect to MySQL Server, do not forget to continue watching MySQL Basics and Performance Tuning courses.
Reference: Pinal Dave (https://blog.sqlauthority.com)