Warning: Using a password on the command line interface can be insecure.

[root@qttc ~]# /usr/local/mysql/bin/mysqldump  -uroot -proot db > bak.sql
Warning: Using a password on the command line interface can be insecure.html

翻譯過來是:在命令行界面上使用密碼能夠是不安全的mysql

這讓人有點鬱悶,5.5用的一直都很爽,到5.6竟然說命令行方式寫密碼不安全?那密碼寫哪呢?sql

在官網文檔找到了原因,你們能夠點擊這裏看看:http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html安全

MySQL users should use the following guidelines to keep passwords secure.bash

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.ide

英文有點爛,但大概讀懂意思,翻譯過來大意是在命令行下若是要使用密碼能夠在執行命令後的提示輸入裏輸入密碼,或者在指定的安全文件內指定密碼。那安全文件時哪一個呢?文檔對此給出了答案:ui

 Store your password in an option file. For example, on Unix, you can list your password in the [client] section of the .my.cnf file in your home directory:spa

能夠在my.cnf內指定,因而打開個人my.cnf,在[mysqldump]下增長:命令行

1
2
user=root
password=root

文中說的在[client]下面加也能夠,但那樣就全部塊的操做都能共享了,因此生產環境上爲了安全仍是儘可能分開。保存退出再dump就ok了。翻譯

[root@qttc ~]# /usr/local/mysql/bin/mysqldump db > bak.sql[root@qttc ~]#

相關文章
相關標籤/搜索