See here http://dev.mysql.com/doc/refman/5.0/en/connecting.html
mysql -u USERNAME -pPASSWORD -h HOSTNAMEORIP DATABASENAME
The options above means:
-u: username
-p: password (**no space between -p and the password text**)
-h: host
last one is name of the database that you wanted to connect.
Look into the link, it's detailed there!
As already mentioned by Rick, you can avoid passing the password as the part of the command by not passing the password like this:
mysql -u USERNAME -h HOSTNAMEORIP DATABASENAME -p
People editing this answer: PLEASE DONOT ADD A SPACE between -p
and PASSWORD
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…