mysql command line query command

faeronsayn

Well-known member
So I want to execute queries through mysql command line on putty.

I can't seem to find a command to do that exactly. If anyone knows, please post it below.
 
Login to MySQL and select your database:

mysql -uUSERNAME -pPASSWORD DBNAME

Type queries into the mysql prompt. Note that you must end queries with a semicolon when using the mysql prompt. The enter key will merely insert a line break into the query which isn't functional. It won't execute the query until you type a semicolon and then hit enter.
 
I would skip the password, is very easy for an attacker to intercept your text data while you send it from a terminal.
 
The way I do it is:
mysql -u root -p

From there, I select whatever options I'm interested to deal with.
 
Top Bottom