Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't quit incorrect mySQL command line

Tags:

mysql

When you type a command into mySQL the wrong way, mySQL won't run the command. Instead of giving an error it sometimes gives an endless list of:

'>
'>
'>
'>

each time you enter something, no matter what input you give it (besides using quit command). I'd like to stay logged in though, so quitting, logging back in and retrying the command with different syntax is very annoying.

Is there a shortcut to just quit a line if it bugs out and stay in the connection?

like image 556
Kiwizoom Avatar asked Jan 22 '15 20:01

Kiwizoom


2 Answers

As per my comment above, the prompt '> indicates that the MySQL shell is in the middle of a string and is waiting for you to close it.

Typing ' and pressing enter closes the string allowing the interpreter to carry on.

A similar prompt shows on various UNIX/Linux shells when a string hasn't been terminated correctly.

like image 115
Phylogenesis Avatar answered Sep 21 '22 17:09

Phylogenesis


You should always terminate SQL commands with a semicolon. As soon as you realize you made a mistake, enter ";" to finish that command and mySQL will warn you that the command was incorrect.

Then you can write your query again. Is that what you were looking for?

like image 38
martintama Avatar answered Sep 21 '22 17:09

martintama