Linux login MySQL server does not need to enter the account password information

Source: Internet
Author: User

Linux login MySQL server is generally the command line to manually enter the link information

[Email protected] ~]# mysql-hlocalhost-uroot-p11111

In the case of MySQL 5.6, there will be security prompts when you log in.

Warning:using a password on the command line interface can be insecure

In order to avoid this hint, and in order not to enter the user name, password every time, you can use a more secure and simple method

Simply configure the MY.CNF client section to write the user name and password information to the client section

# The following options would be passed to all MySQL clients[Client]host = "localhost"
user = "Root"
Password = "11111"
Port = 3306Socket =/tmp/mysql.sock

or write to a separate file, such as/ETC/MYSQL.PWD.CNF, content:

[MySQL]
host = "localhost"
user = "Root"
Password = "11111"
Port = 3306Socket =/tmp/mysql.sock

When logging in, specify this file to log in

[[email protected] ~]# MySQL--DEFAULTS-FILE=/ETC/MYSQL.PWD.CNF

or specify a library login:

[[email protected] ~]# MySQL--DEFAULTS-FILE=/ETC/MYSQL.PWD.CNF library name

Linux login MySQL server does not need to enter the account password information

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.