1. Introduction When we log in to MySQL, we often see a warning: Warning: Using a password on the command line interface can be insecure. This is annoying to look at, and even more annoying when this warning is printed to the screen while writing a script. 2. Solution This warning comes with MySQL. It wants to tell you that it is unsafe to enter the MySQL password directly on the screen and display it. 1. Solution 1 (Just take a look, it’s useless) The solution is relatively simple. When you log in to mysql, do not follow any string after -p. This solution does avoid the warning, but if we make a mistake in input, we can only re-enter the data or press ctrl+backspace to delete it, and we still don’t know where the mistake is. Do you feel that it is troublesome to enter your account and password every time? Then please see the second method. 2. Solution 2 (recommended) Create a hidden file named .my.cnf in your home directory (you can specify the directory yourself). 1. Edit the file: vim .my.cnf [mysql] host=127.0.0.1 user=root password=zxfly 2. When executing login or script. Use the following method: HOME=/root mysql Of course, this directory can be any directory as long as it is specified. Arbitrary parameters can be added to the file, such as port, sock file, etc. Other mysql commands can also be specified in the file. Just add the corresponding modules. For example: the command mysqldump can be as follows [mysqldump] host=127.0.0.1 user=root password=zxfly The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: WeChat applet implements video player sending bullet screen
>>: Explanation of Mac connecting to remote servers through SSH in different terminals
I'm looking for a job!!! Advance preparation:...
I remember that a few years ago, there was an int...
Download the rpm installation package MySQL offic...
Installing Docker on CentOS requires the operatin...
This article shares with you how to use bootstrap...
1. Overview mysql-monitor MYSQL monitoring tool, ...
This article shares the specific code of Vue usin...
1. Modify MySQL login settings: # vim /etc/my.cnf...
This article describes how to install MySQL 5.7 f...
When insert into employee values(null,'張三'...
1. Installation Environment Computer model: Lenov...
Despite props and events, sometimes you still nee...
What is high concurrency? The default Linux kerne...
To install Jenkins on CentOS 8, you need to use t...
1. After installing the Windows version of Docker...