ต้องระบุ MySQL user name ตอน invoke 'mysql' แล้วใส่ password หาก server รันบนระบบต่างจากที่ user login ต้องระบุ host name ด้วย
แนะนำติดต่อ administrator หา connection parameters
พารามิเตอร์ครบแล้ว ใช้คำสั่ง:
shell> mysql -h host -u user -p Enter the password: ***
'host' = hostname ที่ MySQL server รัน, 'user' = MySQL account user name, '***' = password (ใส่ตอน prompt)
สำเร็จจะแสดง introductory info ตามด้วย 'mysql>' prompt
shell> mysql -h host -u user -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 25338 to server version: 8.0.25-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
'mysql>' prompt = พร้อมรับ SQL commands
Note: Login จากเครื่องเดียวกับ MySQL: omit host name ใช้ shell> mysql -u user -p
Error 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) = MySQL server daemon (Unix) หรือ service (Windows) ไม่ได้รัน ติดต่อ administrator
Disconnect:
mysql> QUIT Bye