To connect to MySQL from the command line, follow these steps:
- Open your terminal or command prompt.
- Type the following command:
Replace
username
with your MySQL username (e.g., root). - Press Enter, and you’ll be prompted for your password.
- Enter your MySQL password and press Enter.
- If the credentials are correct, you’ll be logged into the MySQL shell where you can execute SQL queries.