First of all, MySQL has been installed by default, and then I want to connect through the command line.
The first step is to open the command line as an administrator
Administrator Command Prompt appears in the upper left corner
The second step is to switch to the bin directory in the folder where Mysql Server is located
For example, mine is in the following path:
C:\Program Files\MySQL\MySQL Server 8.0\bin
The third step is to enter the following command
Note that -p is followed by the password, without spaces in between
The following figure shows that the connection is successful