We use cookies to improve your experience, deliver personalized content and ads, and analyze website performance. By clicking “Accept All”, you agree to our use of cookies as described in our Privacy Policy
To run commands, you first need to log in. Use this standard format:
Once the prompt changes (usually showing mysql> or postgres=# ), you are inside the engine. Try these: SHOW DATABASES; (MySQL) or \l (PostgreSQL)
Once installed, open your Terminal (macOS/Linux) or Command Prompt/PowerShell (Windows). Step 1: Connect to the Database
After downloading, you might get an error saying 'mysql' or 'psql' is not recognized . This means you need to add the tool to your .
Use your package manager: sudo apt install mysql-client (Ubuntu/Debian) For PostgreSQL (psql)
While graphical interfaces like MySQL Workbench or pgAdmin are popular, true database power users live in the terminal. Executing SQL from the command line is faster, scriptable, and essential for managing remote servers. Whether you are using , 1. How to Download the SQL Command Line Tools
You don't always need to install a full database server to run SQL commands; you often just need the . For MySQL / MariaDB
Always remember to end your SQL statements with a semicolon (;) . Without it, the command line will just wait indefinitely for more input!