How do I quickly log in to MySQL database by password-free?

Source: Internet
Author: User

When we want to log into the MySQL database via mysql-client under the Shell, we always need to enter the password again and again in a very troublesome time.

Usually when we log in to the database, this is the way to log in, as follows

[Email protected]:~# mysql-uroot-penter Password:

How to use input: MySQL just log in directly?

Use. MY.CNF Quick Login

Create a new. my.cnf file in the ~/directory. Of course, if you already have this file, you can modify this file directly!

I personally like to use Vim Dafa, so we can

Vim ~/.MY.CNF

Then write the following information in the file

[Client]password=passworduser=username

Note: because your password is written in the. my.cnf file, be aware of the file permissions to set this file

[Email protected]:~# chmod ~/.my.cnf

Once saved, we can log in to MySQL database directly using MySQL command.

This article is from the "Night" blog, please be sure to keep this source http://liuqun.blog.51cto.com/3544993/1984022

How do I quickly log in to MySQL database by password-free?

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.