The role of Mysql.sock

Source: Internet
Author: User

1. When compiling and installing MySQL, the MySQL configuration file will be copied to/etc/my.conf:

CP support-files/my-small.cnf/etc/  my.cnf Copy configuration template to MySQL configuration file cp: Do you want to overwrite "/etc/my.cnf"? Y

2. You can view the directory location of Mysql.sock by viewing/etc/my.conf:

[Email protected] ~]# cat/etc/my.cnf [mysqld]port            3306socket          =/tmp/  mysql.sockSkip-external-== 4= = = = = 128K

3, when logged in MySQL can add Mysql.sock:

[Email protected] ~]#mysql-u root-poldboy123-s/tmp/ Mysql.sock Welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 5Server Version:5.5. +MySQL Community Server (GPL) Copyright (c) -, -, Oracle and/or its affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h'  forHelp. Type'\c'To clear the current input statement.mysql>

The following content is reproduced: http://jimingsong.iteye.com/blog/1418638

There are two ways to connect MySQL:
(1), TCP/IP
(2), socket
For Mysql.sock, the function is that the program is in the same machine as the MySQLServer and is available when the local connection is initiated.
For example, you do not need to define a specific IP address to connect to the host, as long as it is empty or localhost.
In this case, even if you change the external port of MySQL It is also possible to connect normally.
Since you changed the port in My.ini or MY.CNF, the Mysql.sock is generated with every MySQL server startup. The information has been changed since you restarted MySQL when you finished changing the my.cnf.

Then for an external connection, you must change the port to connect.

Linux under the installation of MySQL connection often back to say that the Mysql.sock file is not found, the solution is simple:

If it is a new installation of MySQL, the prompt cannot find the file, just search under, specify the correct location.

If the Mysql.sock file is mistakenly deleted, you will need to restart the MySQL service, if the restart is successful, will be generated under the DataDir directory Mysql.sock then specify.

If not, you can choose to connect with TCP connection, in fact, under Windows also support pipeline connection mode.

The role of Mysql.sock

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.