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
This article describes the MySQL user management ...
Experimental environment: MYSQL 5.7.22 Enable bin...
Not using lazy loading import Vue from 'vue...
MySQL official website zip file download link htt...
1. CDN It is the most commonly used acceleration ...
Table of contents 1. Extracting functions 2. Merg...
background nginx-kafka-module is a plug-in for ng...
Since Alibaba Cloud's import of custom Ubuntu...
1. Call the parent component method directly thro...
When Docker creates a container, it uses the brid...
Recently, due to the need to test security produc...
Hello everyone, I wonder if you have the same con...
Integrity constraints Integrity constraints are f...
First, let's simulate the data coming from th...
Table of contents Preface environment Install Cre...