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)

Комментарии • 55

  • @GameplayzOfficial
    @GameplayzOfficial 8 месяцев назад

    Dude... more than 2 day, at least 30 posts, and your video did it. Thanks a lot.

  • @ismailk7021
    @ismailk7021 6 месяцев назад

    Thank you! It took an hour of struggling before I found your video. Great tutorial.

  • @renweimiao3676
    @renweimiao3676 2 месяца назад

    After browsing other videos and none of them worked, yours is gold.

  • @arjundeodhar4223
    @arjundeodhar4223 Год назад

    Thankss, really helped a lot, I was only purging mysql, did not realise that there was an issue with mariadb as well :)

  • @ananda.
    @ananda. Год назад +2

    Thanks, man! You made my day!!!

  • @ayamnugget7783
    @ayamnugget7783 12 дней назад

    BRO YOU ARE MY HEROOOOO THXXX BROOOO

  • @jeffleakey
    @jeffleakey Месяц назад

    Thanks, man!

  • @gamatek666
    @gamatek666 Месяц назад

    THX BRO!!!!!!
    sudo apt-get purge mysql-server && sudo apt-get purge mysql-* && sudo apt-get install mysql-server

  • @mamudeveloper
    @mamudeveloper 6 месяцев назад

    Thank you it worked!! this took me more than 24 hrs

  • @juanfernandoechavarria2457
    @juanfernandoechavarria2457 Год назад

    4EVER IN MY

  • @gauravbangamusic
    @gauravbangamusic Месяц назад +1

    But This Command Will Remove MySQL as well erase all your database file that is stored in /var/lib/mysql

    • @linuxsyr
      @linuxsyr  Месяц назад

      @@gauravbangamusic yes ,anyone will first backup his data if he need

    • @gauravbangamusic
      @gauravbangamusic Месяц назад

      @@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

    • @linuxsyr
      @linuxsyr  Месяц назад

      @@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

    • @gauravbangamusic
      @gauravbangamusic Месяц назад

      @@linuxsyr No Problem Bro

    • @mohammadhussain4547
      @mohammadhussain4547 Месяц назад

      ​@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.

  • @suleymanali_76
    @suleymanali_76 Год назад

    Thanks Much. I am grateful for this video

  • @nyarlathotep3
    @nyarlathotep3 9 месяцев назад

    Cara... talvez você não entenda o que eu digo... mas você é maravilhoso

  • @CaptainBullzAQW
    @CaptainBullzAQW Год назад

    theres no fucking way that mariaDB was the culprit, holy shitt thanks man!!

  • @deepakchopdar8478
    @deepakchopdar8478 11 месяцев назад

    Great work .. most usefull video of mysql

  • @falahtech
    @falahtech Год назад

    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

  • @jane-mariefricke6985
    @jane-mariefricke6985 Год назад

    thanks, this really helped a lot. I tried everything but nothing worked

  • @sachinpatil1262
    @sachinpatil1262 2 месяца назад

    same error for mac

  • @silvadev7044
    @silvadev7044 7 месяцев назад

    Perfect!

  • @wilmerchuquitarco2518
    @wilmerchuquitarco2518 Год назад

    thank you very much, the best solution!!!

  • @dennishalo369
    @dennishalo369 10 месяцев назад

    thank you! Problem solved

  • @kawereronald
    @kawereronald 8 месяцев назад

    Thanks, u saved my day ✌️

  • @brandonalexis8263
    @brandonalexis8263 Год назад

    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?

  • @user-ys5jw3nx3s
    @user-ys5jw3nx3s 9 месяцев назад

    Thank you for help.

  • @princess-wl2rc
    @princess-wl2rc Год назад

    you are genius man❤

  • @prakashchaudhary8215
    @prakashchaudhary8215 8 месяцев назад

    thank you very much

  • @fantsy3274
    @fantsy3274 Год назад

    Thankyou so much.

  • @DisobeyZOG
    @DisobeyZOG 5 месяцев назад

    What causes this?

  • @kurdev101
    @kurdev101 10 месяцев назад

    thanks alot this video so helpful for me

  • @mohammadhussain4547
    @mohammadhussain4547 Месяц назад

    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)")

    • @linuxsyr
      @linuxsyr  Месяц назад

      @@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.

    • @linuxsyr
      @linuxsyr  Месяц назад

      @@mohammadhussain4547 you can backup your sever on usb disk : ruclips.net/video/ATDzlHOrZ_s/видео.htmlfeature=shared

    • @mohammadhussain4547
      @mohammadhussain4547 Месяц назад

      @@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"

    • @mohammadhussain4547
      @mohammadhussain4547 Месяц назад

      @@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.

    • @mohammadhussain4547
      @mohammadhussain4547 Месяц назад

      @@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"

  • @dharanivijayakumar2258
    @dharanivijayakumar2258 Год назад

    Thanks so much🥰

  • @imnotalbyy
    @imnotalbyy 9 месяцев назад

    maranza

  • @ssymatt
    @ssymatt 10 месяцев назад

    THANKS BROOOOOO omggg

  • @apoorvpandeyvns
    @apoorvpandeyvns Год назад

    .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.

    • @linuxsyr
      @linuxsyr  Год назад

      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?