Troubleshooting MySQL Login warning Issues

Source: Internet
Author: User
Tags mysql commands mysql login

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.