Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to connect to the database after the loss of mysql.sock

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Security code: it is impossible to have inner peace without a considerable degree of loneliness.

[phenomenon]

The mysql.sock was deleted, making it impossible to connect to the database.

[root@MySQL-01] # mysql-uroot-pEnter password:ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ tmp/mysql.sock' (2)

Prompt cannot connect to MySQL server through mysql.sock.

[solution]

Scenario 1: restart the database to recreate the mysql.sock.

Plan 2: if you can't restart the database temporarily, you can connect to the database through TCP protocol.

MySQL defaults to using UNIX socket file connections instead of TCP/IP from. Starting with MySQL4.1, you can use-- protocol=TCP | SOCKETPIPE | MEMORY to connect to the database.

[root@MySQL-01] # mysql-uroot-p-- protocol=TCPEnter password:Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 16127Server version: 5.6.36-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report