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

Detailed explanation of prototypes and prototype chains in JavaScript

Table of contents Prototype chain diagram Essenti...

Press Enter to automatically submit the form. Unexpected discovery

Copy code The code is as follows: <!DOCTYPE ht...

js regular expression lookahead and lookbehind and non-capturing grouping

Table of contents Combining lookahead and lookbeh...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

IDEA complete code to connect to MySQL database and perform query operations

1. Write a Mysql link setting page first package ...

Summary of Nginx location and proxy_pass path configuration issues

Table of contents 1. Basic configuration of Nginx...

Specific use of CSS front-end page rendering optimization attribute will-change

Preface When scroll events such as scroll and res...

JavaScript form validation example

HTML forms are commonly used to collect user info...

How to configure two or more sites using Apache Web server

How to host two or more sites on the popular and ...

How to build a K8S cluster and install docker under Hyper-V

If you have installed the Win10 system and want t...

How to build sonarqube using docker

Table of contents 1. Install Docker 2. Install so...

Implementation of Linux command line wildcards and escape characters

If we want to perform batch operations on a type ...