Home > Enterprise >  mysql command line stuck on "->"
mysql command line stuck on "->"

Time:09-25

I'm trying to learn how to use mysql from the command line but I'm running into problems. Typing a simple SHOW VARIABLES results in me getting a -> prompt and no output. Pic below:

enter image description here

I'm running mysql 8.0.26 on a MacBook Pro with Big Sur 11.6.

What am I doing wrong?

CodePudding user response:

You haven't ended your statement - mysql statements end with a semicolon

i.e.

SHOW VARIABLES;

Edit: Good point by IMSoP below. To expand: When you haven't completed your statement using a semicolon, the statement can continue on subsequent lines - mysql is not sensitive to white space or line breaks. The prompt will change to indicate mysql is still waiting for the rest of the statement, as in the table below (Source)

Prompt Meaning
mysql> Ready for new query
-> Waiting for next line of multiple-line query
'> Waiting for next line, waiting for completion of a string that began with a single quote (')
"> Waiting for next line, waiting for completion of a string that began with a double quote (")
`> Waiting for next line, waiting for completion of an identifier that began with a backtick (`)
/*> Waiting for next line, waiting for completion of a comment that began with /*
  • Related