当您的密码包含一些特殊字符(如@,$等)时,也会发生这种情况。
为了避免这种情况,您可以用单引号将密码括起来:
$ mysql -usomeuser -p's0mep@$$w0Rd'
或者输入时不要使用密码。将其留空,然后在终端请求时键入。这是推荐的方法。
$ mysql -usomeuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 191
Server version: 5.5.46-0ubuntu0.14.04.2 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>