ERROR 2002 HY000 Can't connect to local MySQL server through socket var run mysqld | Ubuntu 22.04
HTML-код
- Опубликовано: 23 авг 2024
- × mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-12-04 17:30:03 CET; 3min 36s ago
CPU: 12ms
Dez 04 17:30:03 hame-m122 systemd[1]: mysql.service: Scheduled restart job, restart counter is at
Dez 04 17:30:03 hame-m122 systemd[1]: Stopped MySQL Community Server.
Dez 04 17:30:03 hame-m122 systemd[1]: mysql.service: Start request repeated too quickly.
Dez 04 17:30:03 hame-m122 systemd[1]: mysql.service: Failed with result exit-code.
Dez 04 17:30:03 hame-m122 systemd[1]: Failed to start MySQL Community Server.
Failed to start mysql.service: Unit mysql.service failed to load properly, please adjust/correct and reload service manager: Device or resource busy
× mysql.service - MySQL Community Server
Loaded: error (Reason: Unit mysql.service failed to load properly, please adjust/correct and
Active: failed (Result: exit-code) since Sun 2022-12-04 17:30:03 CET; 1min 45s ago
CPU: 12ms
ERROR 2002 (HY000): Can't connect to local MySQL server through socket /var/run/mysqld/mysqld.sock (2)
Dude... more than 2 day, at least 30 posts, and your video did it. Thanks a lot.
Thank you! It took an hour of struggling before I found your video. Great tutorial.
After browsing other videos and none of them worked, yours is gold.
Thankss, really helped a lot, I was only purging mysql, did not realise that there was an issue with mariadb as well :)
Thanks, man! You made my day!!!
BRO YOU ARE MY HEROOOOO THXXX BROOOO
Thanks, man!
THX BRO!!!!!!
sudo apt-get purge mysql-server && sudo apt-get purge mysql-* && sudo apt-get install mysql-server
Thank you it worked!! this took me more than 24 hrs
4EVER IN MY
But This Command Will Remove MySQL as well erase all your database file that is stored in /var/lib/mysql
@@gauravbangamusic yes ,anyone will first backup his data if he need
@@linuxsyr Thanks For The Reply, I am Stuck in the same problem from last 3 days tried all things but issue not resolved I don't have MySQL back up in my local system only in server how I can resolve this issue please guide me
@@gauravbangamusic Thank you for your response, brother. Sorry for the delay in answering. It is better to ask chatgpt it is powerful and really helps you
@@linuxsyr No Problem Bro
@gauravbangamusic did you find the solution? I am experiencing the same problem on my contabo server and my sites are on CyberPanel. I don't know how can I recover my site without losing all the data.
Thanks Much. I am grateful for this video
Cara... talvez você não entenda o que eu digo... mas você é maravilhoso
theres no fucking way that mariaDB was the culprit, holy shitt thanks man!!
Great work .. most usefull video of mysql
hello, I have same error, but not resolved by steps you guided.
may i know how to connect with you to share some screenshots of errors I am facing
thanks, this really helped a lot. I tried everything but nothing worked
same error for mac
Perfect!
thank you very much, the best solution!!!
thank you! Problem solved
Thanks, u saved my day ✌️
good video but it wasn't able to solve the problem in my case, i followed all steps that used in the video and i installed until end the mariadb server but this unfortunately didn't work. do you know other idea to solve it?
Thank you for help.
you are genius man❤
thank you very much
Thankyou so much.
What causes this?
thanks alot this video so helpful for me
Will I be able to resolve this issue using your method? Sorry I am not much technical but I have sites running in my CyberPanel and don't want to lose them or the data.
OperationalError at /
(2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
@@mohammadhussain4547 you can try this, no losing data. Chatgpt can really help, create an account and ask him:
The error message you're encountering indicates that your MySQL server is not running or is not reachable through the socket file specified. This issue can often be resolved without data loss by restarting the MySQL service or checking the configuration.
Here are some steps you can take to resolve this issue safely:
1. **Check if MySQL Service is Running**:
Open your terminal and run:
```
sudo systemctl status mysql
```
If the service is not running, start it with
```
sudo systemctl start mysql
```
2. **Restart MySQL Service**:
If MySQL is running but you still encounter the issue, try restarting the service:
```
sudo systemctl restart mysql
```
3. **Check MySQL Logs**:
Sometimes, the logs can provide more detailed information about the error. Check the MySQL logs located in `/var/log/mysql/` or `/var/log/mysqld.log`.
4. **Check the MySQL Configuration**:
Ensure that the MySQL configuration file (`my.cnf` or `mysqld.cnf`) has the correct socket path. The configuration file is usually located in `/etc/mysql/` or `/etc/mysql/mysql.conf.d/`.
```
sudo nano /etc/mysql/my.cnf
```
Look for the `socket` setting and make sure it matches:
```ini
[mysqld]
socket=/var/run/mysqld/mysqld.sock
[client]
socket=/var/run/mysqld/mysqld.sock
```
5. **Permissions on the Socket Directory**:
Ensure that the MySQL user has the correct permissions on the `/var/run/mysqld/` directory:
```
sudo chown -R mysql:mysql /var/run/mysqld/
```
6. **Disk Space**:
Make sure your server has enough disk space. Low disk space can sometimes cause MySQL to stop working properly:
```
df -h
```
7. **Reboot Your Server**:
As a last resort, rebooting your server can sometimes resolve temporary issues:
```
sudo reboot
```
Before performing any of these steps, ensure you have recent backups of your databases. While these steps are generally safe and should not cause data loss, having a backup is always a good precaution.
If you need further assistance, please provide additional details about your server environment and any recent changes that might have triggered this issue.
@@mohammadhussain4547 you can backup your sever on usb disk : ruclips.net/video/ATDzlHOrZ_s/видео.htmlfeature=shared
@@linuxsyr when I tried restarting mysql it says "Job for mariadb.service failed because the control process exited with error code.
I used systemctl status mariadb.service and it says "main process exited *** & Failed to start MariaDB 10.3.39 database server"
@@linuxsyr I have GPT but not sure If I will mess up anything and make it more difficult to recover because I am not much techy into this.
@@linuxsyr I tried restarting the server, MySql everything but no use. When I used this command "sudo systemctl start mysql" it gives me this error:
"Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details."
When used the status command it gives:
"mariadb.service: Main process exited, code=exited, status=1/FAILURE
mariadb.service: Failed with result 'exit-code'
Failed to start MariaDB 10.3.39 database server"
Thanks so much🥰
maranza
THANKS BROOOOOO omggg
.This video is for installing marian DB, not mysql, at the end of the video you install marian db instead of MySQL please correcect your error.
My video title is the error message which printed on terminal. Mariadb is the same as mysql [as a branch of it]. Since you are an expert on the difference between software, you can know what you want and i do not need to adjust anything. Your comment does not motivate me to change anything in my video, can you justify more?