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

JSONP cross-domain simulation Baidu search

Table of contents 1. What is JSONP 2. JSONP cross...

How to add Lua module to Nginx

Install lua wget http://luajit.org/download/LuaJI...

A brief discussion on the pitfalls of react useEffect closure

Problem code Look at a closure problem code cause...

Detailed steps for installing, configuring and uninstalling QT5 in Ubuntu 14.04

1. I downloaded QT5.13 version before, but after ...

MySQL complete collapse: detailed explanation of query filter conditions

Overview In actual business scenario applications...

Implementation of nginx proxy port 80 to port 443

The nginx.conf configuration file is as follows u...

DOM operation implementation in react

Table of contents Previous words Usage scenarios ...

MySQL subqueries and grouped queries

Table of contents Overview Subqueries Subquery Cl...

Summary and analysis of commonly used Docker commands and examples

Table of contents 1. Container lifecycle manageme...

Vue3 implements CSS infinite seamless scrolling effect

This article example shares the specific code of ...

Detailed installation and use tutorial of mysql 8.0.15 under windows

This article shares with you the detailed install...

Practical basic Linux sed command example code

The Linux stream editor is a useful way to run sc...

How to uninstall MySQL 5.7.19 under Linux

1. Find out whether MySQL was installed before Co...

Solution to the garbled code problem in MySQL 5.x

MySQL is a commonly used open source database sof...