Home>

Can't start mysql with command

mysql -u root -p

After entering the password, it gives an error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

on startup

mysqladmin -u root -p status
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
sudo service mysql start:

Error:

Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
systemctl status mysql.service

Error:

● mysql.service -MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-09-25 17:43:51 EEST; 1min 21s ago
    Process: 7786 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=203/EXEC)
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Failed with result 'exit-code'.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Failed to start MySQL Community Server.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Scheduled restart job, restart counter is>Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Stopped MySQL Community Server.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Start request repeated too quickly.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Failed with result 'exit-code'.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Failed to start MySQL Community Server.
journalctl -xe

Error:

● mysql.service -MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-09-25 17:43:51 EEST; 2min 24s ago
    Process: 7786 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=203/EXEC)
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Failed with result 'exit-code'.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Failed to start MySQL Community Server.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Scheduled restart job, restart counter is>Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Stopped MySQL Community Server.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Start request repeated too quickly.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Failed with result 'exit-code'.
Sep 25 17:43:51 hulimulushka-HP-ProBook-450-G6 systemd[1]: Failed to start MySQL Community Server.
(remind) [email protected]:~/coding/python/remind$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
(remind) [email protected]:~/coding/python/remind$ journalctl -xe
--Support: http://www.ubuntu.com/support
--
--The mysql.service unit failed.
--
--Result: failed.
Sep 25 17:46:24 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Scheduled restart job, restart counter is>--Subject: Assigned automatic restart unit
--Defined-By: systemd
--Support: http://www.ubuntu.com/support
--
--Assigned automatic restart of the mysql.service unit because it was set to
--parameter Restart=.Sep 25 17:46:24 hulimulushka-HP-ProBook-450-G6 systemd[1]: Stopped MySQL Community Server.--Subject: Stopped mysql.service unit.
--Defined-By: systemd
--Support: http://www.ubuntu.com/support
--
--The process of stopping the mysql.service unit has been completed.
Sep 25 17:46:24 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Start request repeated too quickly.
Sep 25 17:46:24 hulimulushka-HP-ProBook-450-G6 systemd[1]: mysql.service: Failed with result 'exit-code'.
--Subject: Unit failed
--Defined-By: systemd
--Support: http://www.ubuntu.com/support
--
--The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Sep 25 17:46:24 hulimulushka-HP-ProBook-450-G6 systemd[1]: Failed to start MySQL Community Server.
--Subject: mysql.service unit error
--Defined-By: systemd
--Support: http://www.ubuntu.com/support
--
--The mysql.service unit failed.
--
--Result: failed.

First, both of these commands do not start the server, but connect to a pre-launched server. Second, how did you install mysql and which version?

andreymal2022-01-15 17:36:54

tproger.ru/articles/django-sqlite-to-mysql Follow this tutorial

Tut budet Ima2022-01-15 17:36:54

sudo service mysql start

Вадим Александру2022-01-15 17:36:54

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details

Tut budet Ima2022-01-15 17:36:54

Well, actually do what this text suggests

andreymal2022-01-15 17:36:54
  • Answer # 1

    The error message contains the line:

    ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=203/EXEC)

    In man 5 systemd.exec, the return code 203 is described as follows:

    The actual process execution failed (specifically, the execve(2) system call). Most likely this is caused by a missing or non-accessible executable file.

    That is, check if you have the MySQL server executable in place, it is also worth checking for the presence of bash, which is used to run the /usr/share/mysql/mysql-systemd-start file mentioned, like so:

    ls -l /usr/sbin/mysqld /bin/bash

    The result might look something like this (for Ubuntu 18.04):

    -rwxr-xr-x 1 root root 1113504 Jun 7 2019 /bin/bash
        -rwxr-xr-x 1 root root 24691368 Jul 20 13:50 /usr/sbin/mysqld
    

    Check that both files exist and have read and run permissions set.