Problems with installing mysql and mysql.sock under linux

Problems with installing mysql and mysql.sock under linux

Recently, I encountered many problems when installing Aphace, mysql, and php on Linux. The problems encountered when installing apache and php were simpler and could be solved by searching on Baidu or Google. However, I encountered a problem when installing mysql that troubled me for a long time.

I am using Ubuntu 7.0. When I installed MySQL, I always got an error when I ran mysqladmin version:

 can't connect to local MySQL server through socket 'var/run/mysqld/mysqld.sock'

This almost made me collapse. I searched for many solutions on the Internet, and there are probably several solutions:

1. Permission issues

2. Modify the /etc/my.cnf file

3. Operating system or MySQL upgrade

4. Create /var/run/mysqld/mysqld.sock

I have tried all the above methods, but none of them solved the problem. I'm about to give up, but I think if I hold on a little longer, I'll be able to solve it. I am going to send an email to easychen and zoltan for advice. When I was about to send the email, I wondered if I could change my mindset. My idea is: since can't connect to socket '/var/run/mysqld/mysqld.sock' , can't I just add the socket parameters at the end?

That is: mysqladmin version --socket == /tmp/mysql.sock

Something unexpected happened and the problem was solved. I am so happy. Although the problem is solved, I don't know why it is like this. Why is the default /var/run/mysqld /mysqld.sock? I checked in the my.cnf file, and the socket path in the client and mysqld is /tmp/mysql.sock, and the socket specified at compile time is also /tmp/mysql.sock! This is really a bit confusing, it seems I need to look for the answer on the Internet! I hope people in the know can give me some advice.

Next, I will introduce the liunx mysql.sock problem to you separately.

Error code: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '

mysql.sock is not in the /var/lib/mysql directory at all. Your own directory is in /tmp/mysql.sock

So a connection was made.

 ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

Just restart it

Note: ln usage: ln -s source file target file ln command details:

Summarize

The above is the editor's introduction to the installation of MySQL and mysql.sock under Linux. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • In-depth analysis of the mysql.sock missing problem
  • Detailed explanation of the function of mysql socket file
  • Detailed explanation of pid and socket in MySQL
  • Solve the xampp self-start and mysql.sock problems
  • How to avoid mysql startup errors and sock file function analysis

<<:  Summary of Linux command methods to view used commands

>>:  Diving into JS inheritance

Recommend

JavaScript object built-in objects, value types and reference types explained

Table of contents Object Object Definition Iterat...

Ubuntu 15.04 opens mysql remote port 3306

Ubuntu 15.04 opens MySQL remote port 3306. All th...

Introduction to Vue3 Composition API

Table of contents Overview Example Why is it need...

Detailed usage of docker-maven-plugin

Table of contents Docker-Maven-Plugin Maven plugi...

Summary of situations where MySQL indexes will not be used

Types of Indexes in MySQL Generally, they can be ...

Basic installation process of mysql5.7.19 under winx64 (details)

1. Download https://dev.mysql.com/downloads/mysql...

A brief discussion on the solution to excessive data in ElementUI el-select

Table of contents 1. Scenario Description 2. Solu...

MySQL5.6.31 winx64.zip installation and configuration tutorial

#1. Download # #2. Unzip to local and modify nece...

Analysis of two implementation methods for adding static routing in Linux

Command to add a route: 1.Route add route add -ne...

Detailed explanation of the solution to the nginx panic problem

Regarding the nginx panic problem, we first need ...

Detailed explanation of Redis master-slave replication practice using Docker

Table of contents 1. Background 2. Operation step...

Summarize the User-Agent of popular browsers

1. Basic knowledge: Http Header User-Agent User A...