Recently the MySQL from 5.5 liters to 5.6, mysqldump incredibly bad use, hint:
The code is as follows |
Copy Code |
[ROOT@QTTC ~]#/usr/local/mysql/bin/mysqldump-uroot-proot db > Bak.sql Warning:using a password on the command line interface can is insecure. |
It is not safe to use a password on the command line interface.
This is a bit depressing, 5.5 use has been very cool, to 5.6 actually said that the command line way to write the password is not safe? What about the code?
In the official website document found the reason, we can click here to see: http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html
MySQL users should use the following guidelines to keep passwords secure.
When your run a client program to connect to the MySQL server, it are inadvisable to specify your password in a way that exp OSes it to discovery by the other users. The methods can use to specify your password while you run client programs are-listed here, along and an assessment of The risks of each method. In short, the safest methods are to have the client program prompt for the password and to specify the password in a proper LY protected option file.
English is a bit rotten, but probably read the meaning, translated to the effect is at the command line if you want to use a password, you can enter a password in the prompt input after the command is executed, or specify a password within the specified security file. Which one is the security document? The document gives an answer to this:
Store your password in a option file. For example, on Unix, your can list your password in the [client] section of the "My.cnf file in your home directory:
Can be specified within the MY.CNF, so open my my.cnf and add under [mysqldump]:
The code is as follows |
Copy Code |
User=root Password=root
|
The article said that under [client] add also can, but that all block operation can be shared, so the production environment for security or as far as possible apart. Save exit and dump on OK.
code is as follows |
copy code |
[ROOT@QTTC ~ ]#/usr/local/mysql/bin/mysqldump db > Bak.sql [root@qttc ~]# |