In Linux, I use my. cnf. mysql does not need to enter the account password to connect to the server.

Source: Internet
Author: User

In Linux, mysql is often used to connect to the server every time:

  1. [Root @ localhost ~] # Mysql-hlocalhost-uroot-p11111
Every time I enter the user name, password, and more people, is there a more convenient way?

We only need to simply configure the client section of my. cnf and put the username and password information in the client section. The configuration example is as follows:

  1. # The following options will be passed to all MySQL clients
  2. 18 [client]
  3. 19 host = "localhost"
  4. 20 password = "11111"
  5. 21 user = "root"
  6. 22 port = 3306
  7. 23 socket =/tmp/mysql. sock
After modifying my. cnf, you can easily connect to the specified server by running mysql directly without restarting the server.

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.