6.1.2.1 End-User Guidelines for Password Security密码安全最终用户指南

MySQL users should use the following guidelines to keep passwords secure.MySQL用户应该使用以下准则来保护密码的安全。

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. 当你运行一个客户端程序连接到MySQL服务器时,不建议以一种让其他用户发现的方式指定你的密码。此处列出了运行客户端程序时可用于指定密码的方法,以及每种方法的风险评估。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.简而言之,最安全的方法是让客户端程序提示输入密码,或者在受适当保护的选项文件中指定密码。

On Unix, the mysql client writes a record of executed statements to a history file (see Section 4.5.1.3, “mysql Client Logging”). 在Unix上,mysql客户端将执行语句的记录写入历史文件(参阅第4.5.1.3节,“mysql客户端日志记录”)。By default, this file is named .mysql_history and is created in your home directory. 默认情况下,此文件名为.mysql_history,在您的主目录中创建。Passwords can be written as plain text in SQL statements such as CREATE USER and ALTER USER, so if you use these statements, they are logged in the history file. 密码可以在SQL语句(如CREATE USERALTER USER)中以纯文本形式编写,因此如果您使用这些语句,它们将记录在历史文件中。To keep this file safe, use a restrictive access mode, the same way as described earlier for the .my.cnf file.为了保护此文件的安全,请使用限制访问模式,与前面对.my.cnf文件所述的方式相同。

If your command interpreter maintains a history, any file in which the commands are saved contains MySQL passwords entered on the command line. 如果您的命令解释器维护历史记录,则保存命令的任何文件都包含在命令行上输入的MySQL密码。For example, bash uses ~/.bash_history. Any such file should have a restrictive access mode.例如,bash使用~/.bash_history。任何此类文件都应该具有限制访问模式。