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
Get the current date + time (date + time) functio...
React is different from Vue. It implements route ...
DTD is a set of grammatical rules for markup. It i...
1. Environmental requirements 1. Docker 17 and ab...
I searched a lot of articles online but didn'...
Debug branch During the normal development of a p...
What you will learn 1. Software installation and ...
Table of contents background What is the Metavers...
It is too troublesome to find the installation tu...
1. Understand the WEB Web pages are mainly compos...
Table of contents Normal paging query How to opti...
Because using group by in MySQL always results in...
Preface Although some love in this world has a pr...
RocketMQ is a distributed, queue-based messaging ...
1. Use contrasting colours. The contrast here ref...