停下两秒钟 发表于 2015-09-13 21:55

mysql5.6命令行传递密码无法登陆


$ /usr/local/mysql/bin/mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

而不传递密码则能正常登录
$ /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.25-73.1-log Source distribution

Copyright (c) 2009-2015 Percona LLC and/or its affiliates
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>

现在用一些工具比如sysbench --mysql-user=root --mysql-password=123456 和一些程序连接时候没法使用了,该怎么解决这个问题

csoho2000 发表于 2015-09-20 17:26

    When you run a client program to connect to the MySQL server, it is inadvisable to specify your password in a way that exposes it to discovery by other users. The methods you can use to specify your password when you run client programs are listed here, along with an assessment of the risks of each method. In short, the safest methods are to have the client program prompt for the password or to specify the password in a properly protected option file.

Store your password in an option file. For example, on Unix, you can list your password in the section of the .my.cnf file in your home directory:
页: [1]
查看完整版本: mysql5.6命令行传递密码无法登陆