First, preface
We often see a warning when we log in to MySQL:
Warning:using a password on the command line interface can is insecure.
It's uncomfortable to look at, and it's even more uncomfortable when writing a script that warns the output to the screen.
Ii. Solutions
This warning is from MySQL, he wants to tell you to enter the MySQL password directly on the screen and display is not safe.
1, the solution one (look on the line does not have any use)
This workaround is relatively straightforward, and after-P is not immediately followed by any strings when you log in to MySQL.
The solution, indeed, is to circumvent the warning, but if we enter the error, we can only re-data or ctrl+backspace to delete, do not know what is wrong.
Do you feel the need to enter the account password every time is very troublesome, then see the second method.
2. Solution II (recommended)
Create a hidden file under your home directory (you can specify your own directory) the name is. my.cnf.
1. Edit the file:
Vim. my.cnf
[MySQL]
host=127.0.0.1
User=root
Password=zxfly
2, during the execution of the login, or script time. Use the following methods:
Home=/root MySQL
Of course, this directory can be any directory, as long as you specify it. You can add arbitrary parameters to the file, such as ports, sock files, and so on.
Other MySQL commands can also be specified in the file. Add the appropriate module.
For example: command mysqldump can be as follows
[Mysqldump]
host=127.0.0.1
User=root
Password=zxfly
Troubleshooting MySQL Login warning Issues