How to log in to mysql using cmd

To log in to MySQL using the command line, you can follow these steps:

  1. To open the command line interface, you can either click on the Start menu on Windows and search for “cmd,” or open the terminal application on Linux/macOS.
  2. Use the following command to access the MySQL server:
mysql -u 用户名 -p

The username should be replaced with your MySQL username.

  1. After pressing enter, the system will prompt to input the password. Enter the corresponding password (the password will not be displayed on the command line).
  2. If the username and password are both correct, the command line will display a MySQL interactive command prompt, indicating that you have successfully logged in to the MySQL server.

Please make sure that MySQL is correctly installed and configured, and the MySQL server is running before executing the above command.

bannerAds