mysql 命令行卡在“->”
mysql command line stuck on "->"
我正在尝试学习如何从命令行使用 mysql,但我 运行 遇到了问题。输入一个简单的 SHOW VARIABLES
导致我得到一个 ->
提示并且没有输出:
mysql> SHOW VARIABLES
-> █
我是 运行 mysql 8.0.26,配备 Big Sur 11.6 的 MacBook Pro。
我做错了什么?
您还没有结束您的语句 - mysql 语句以分号结尾
即
SHOW VARIABLES;
编辑:下面 IMSoP 的观点很好。展开:当您还没有使用分号完成您的语句时,该语句可以在后续行继续 - mysql 对白色 space 或换行符不敏感。提示将更改为指示 mysql 仍在等待语句的其余部分,如 (Source)
下面的 table
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 /*
我正在尝试学习如何从命令行使用 mysql,但我 运行 遇到了问题。输入一个简单的 SHOW VARIABLES
导致我得到一个 ->
提示并且没有输出:
mysql> SHOW VARIABLES
-> █
我是 运行 mysql 8.0.26,配备 Big Sur 11.6 的 MacBook Pro。
我做错了什么?
您还没有结束您的语句 - mysql 语句以分号结尾
即
SHOW VARIABLES;
编辑:下面 IMSoP 的观点很好。展开:当您还没有使用分号完成您的语句时,该语句可以在后续行继续 - mysql 对白色 space 或换行符不敏感。提示将更改为指示 mysql 仍在等待语句的其余部分,如 (Source)
下面的 tablePrompt | 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 /* |