To open MySQL from the command line, follow these steps: Open a command prompt or terminal. Enter the MySQL command: mysql -u
-p. Enter your password (if set). Enter SELECT VERSION(); to view the MySQL version and confirm that it is connected. Type exit to exit MySQL.
How to open MySQL in the command line
Opening MySQL in the command line is very simple, just follow the following Steps:
1. Open the command prompt or terminal
2. Enter the MySQL command
In the command prompt or terminal, enter the following command:
<code>mysql -u <用户名> -p</code>
Where:
<Username>
is the MySQL username you created. <Password>
is the MySQL password you set. 3. Enter the password
If you set a password when installing MySQL, the system will prompt you to enter the password. After entering the password, press Enter.
4. Now that you are connected to MySQL
Enter the following command to view the MySQL version:
<code>SELECT VERSION();</code>
You will see output similar to the following:
<code>+-----------+ | VERSION() | +-----------+ | 8.0.27 | +-----------+</code>
This means you have successfully connected to MySQL. You can continue to enter MySQL commands to manage your database.
5. Exit MySQL
To exit MySQL, enter the following command:
<code>exit</code>
The above is the detailed content of Where to open mysql command line. For more information, please follow other related articles on the PHP Chinese website!