Ошибка юнита mysql service

After rebooting server, I can’t start mysql again

I received this message:

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

I tried journalctl -xe and received this

-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Unit entered failed state.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 06 21:25:57 myserver systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Nov 06 21:25:57 myserver systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Nov 06 21:25:58 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

here is the result for systemctl status mysql.service

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Sun 2016-11-06 21:29:00 UTC; 21s ago
  Process: 4563 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 4560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 4563 (code=exited, status=1/FAILURE);         : 4566 (mysql-systemd-s)
    Tasks: 2
   Memory: 320.0K
      CPU: 400ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─4566 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─4625 sleep 1

Nov 06 21:29:00 myserver systemd[1]: Starting MySQL Community Server...
Nov 06 21:29:01 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

Please help ! Thank you!

root@broadband:/var/lib/mysql# sudo /etc/init.d/mysql start
[….] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See «systemctl status mysql.service» and «journalctl -xe» for details.
failed!
root@broadband:/var/lib/mysql# systemctl status mysql.service
● mysql.service — LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Пт 2018-08-03 15:38:42 MSK; 1min 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 14097 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

авг 03 15:38:42 broadband /etc/init.d/mysql[15142]: 0 processes alive and ‘/usr/bin/mysqladmin —defaults-file=/etc/mysql/debian.cnf ping’ resulted in
авг 03 15:38:42 broadband /etc/init.d/mysql[15142]: [61B blob data]
авг 03 15:38:42 broadband /etc/init.d/mysql[15142]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 «Connection refused»)’
авг 03 15:38:42 broadband /etc/init.d/mysql[15142]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
авг 03 15:38:42 broadband /etc/init.d/mysql[15142]:
авг 03 15:38:42 broadband mysql[14097]: …fail!
авг 03 15:38:42 broadband systemd[1]: mysql.service: Control process exited, code=exited status=1
авг 03 15:38:42 broadband systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
авг 03 15:38:42 broadband systemd[1]: mysql.service: Unit entered failed state.
авг 03 15:38:42 broadband systemd[1]: mysql.service: Failed with result ‘exit-code’.
root@broadband:/var/lib/mysql#

root@broadband:/var/lib/mysql# journalctl -xe
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Started in read only mode
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Using mutexes to ref count buffer pool pages
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: The InnoDB memory heap is disabled
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Compressed tables use zlib 1.2.8
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Using Linux native AIO
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Not using CPU crc32 instructions
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Disabling background IO write threads.
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Warning] InnoDB: Unable to open «./ib_logfile0» to check native AIO read support.
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Warning] InnoDB: Linux Native AIO disabled.
авг 03 15:45:18 broadband mysqld[19045]: 180803 15:45:18 [Note] InnoDB: Initializing buffer pool, size = 6.0G
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [Note] InnoDB: Completed initialization of buffer pool
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [ERROR] InnoDB: Cannot create log files in read-only mode
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [ERROR] Plugin ‘InnoDB’ init function returned error.
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [Note] Plugin ‘FEEDBACK’ is disabled.
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [ERROR] Unknown/unsupported storage engine: InnoDB
авг 03 15:45:19 broadband mysqld[19045]: 180803 15:45:19 [ERROR] Aborting
авг 03 15:45:19 broadband mysqld[19045]:
авг 03 15:45:20 broadband mysqld[19045]: 180803 15:45:20 [Note] /usr/sbin/mysqld: Shutdown complete
авг 03 15:45:20 broadband mysqld[19045]:
авг 03 15:45:20 broadband mysqld_safe[19062]: mysqld from pid file /var/run/mysqld/mysqld.pid ended
авг 03 15:45:24 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=188.170.82.201 DST=188.32.114.207 LEN=52 TOS=0x00 PREC=
авг 03 15:45:43 broadband CRON[18327]: pam_unix(cron:session): session closed for user root
авг 03 15:45:49 broadband /etc/init.d/mysql[19509]: 0 processes alive and ‘/usr/bin/mysqladmin —defaults-file=/etc/mysql/debian.cnf ping’ resulted in
авг 03 15:45:49 broadband systemd[1]: mysql.service: Control process exited, code=exited status=1
авг 03 15:45:49 broadband mysql[18463]: …fail!
авг 03 15:45:49 broadband /etc/init.d/mysql[19509]: [61B blob data]
авг 03 15:45:49 broadband systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
— Subject: Ошибка юнита mysql.service
— Defined-By: systemd
— Support: lists.freedesktop.org/mailman/listinfo/systemd-devel

— Произошел сбой юнита mysql.service.

— Результат: failed.
авг 03 15:45:49 broadband /etc/init.d/mysql[19509]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 «Connection refused»)’
авг 03 15:45:49 broadband systemd[1]: mysql.service: Unit entered failed state.
авг 03 15:45:49 broadband /etc/init.d/mysql[19509]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
авг 03 15:45:49 broadband systemd[1]: mysql.service: Failed with result ‘exit-code’.
авг 03 15:45:49 broadband /etc/init.d/mysql[19509]:
авг 03 15:45:50 broadband sudo[18446]: pam_unix(sudo:session): session closed for user root


  • Вопрос задан

    более трёх лет назад

  • 27101 просмотр

Пригласить эксперта

А доступ у юзера, под которым запускается mysql, к файлам внутри /var/lib/mysql есть?

У вас не инициализируется плагин InnoDB, поэтому процесс останавливается. Почему — причины бывают разные, самая банальная — не хватает памяти. Иногда бывают проблемы с файлами

/var/lib/mysql/ib_logfile0
/var/lib/mysql/ib_logfile1

и помогает удаление.
Я бы начал с памяти, уменьшил бы немного настройки.

/var/lib/mysql/ibdata1 — НЕ УДАЛЯТЬ

Похоже у mysql проблемы с логами.
Попробуй перенести логи
mv /var/lib/mysql/ib_log* /tmp
После чего можно запускать. Если в /var/lib/mysql/ таких файлов нету, то проверь в /etc/mysql/my.cnf какие значения у параметров

innodb_data_home_dir

и

innodb_log_group_home_dir

И соответственно в этом каталоге искать файлы логов. Ругается он вроде только на ib_logfile0

Сейчас выдает такие ошибки [….] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See «systemctl status mysql.service» and «journalctl -xe» for details.
failed!
root@broadband:/var/lib/mysql# journalctl -xe
авг 03 16:23:03 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=212.34.248.214 DST=188.32.114.207 LEN=40 TOS=0x00 PREC=
авг 03 16:23:10 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=83.220.237.132 DST=188.32.114.207 LEN=40 TOS=0x08 PREC=
авг 03 16:23:10 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=83.220.237.132 DST=188.32.114.207 LEN=40 TOS=0x08 PREC=
авг 03 16:23:11 broadband sudo[6000]: root : TTY=pts/0 ; PWD=/var/lib/mysql ; USER=root ; COMMAND=/etc/init.d/mysql start
авг 03 16:23:11 broadband sudo[6000]: pam_unix(sudo:session): session opened for user root by serveradmin(uid=0)
авг 03 16:23:11 broadband systemd[1]: Starting LSB: Start and stop the mysql database server daemon…
— Subject: Начинается запуск юнита mysql.service
— Defined-By: systemd
— Support: lists.freedesktop.org/mailman/listinfo/systemd-devel

— Начат процесс запуска юнита mysql.service.
авг 03 16:23:11 broadband mysql[6017]: * Starting MariaDB database server mysqld
авг 03 16:23:14 broadband mysqld_safe[6622]: Starting mysqld daemon with databases from /var/lib/mysql
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [Warning] ‘THREAD_CONCURRENCY’ is deprecated and will be removed in a future release.
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [Warning] ‘THREAD_CONCURRENCY’ is deprecated and will be removed in a future release.
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [Note] /usr/sbin/mysqld (mysqld 10.0.33-MariaDB-0ubuntu0.16.04.1) starting as process 6626 …
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [ERROR] mysqld: File ‘/var/log/mysql/mysql-bin.index’ not found (Errcode: 13 «Permission denied»)
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [ERROR] Aborting
авг 03 16:23:14 broadband mysqld[6627]:
авг 03 16:23:14 broadband mysqld[6627]: 180803 16:23:14 [Note] /usr/sbin/mysqld: Shutdown complete
авг 03 16:23:14 broadband mysqld[6627]:
авг 03 16:23:14 broadband mysqld_safe[6630]: mysqld from pid file /var/run/mysqld/mysqld.pid ended
авг 03 16:23:20 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=188.92.20.98 DST=188.32.114.207 LEN=40 TOS=0x00 PREC=0x
авг 03 16:23:24 broadband kernel: [UFW BLOCK] IN=enp5s0f0 OUT= MAC=00:15:17:2a:e6:70:00:00:5e:00:01:95:08:00 SRC=195.38.23.96 DST=188.32.114.207 LEN=52 TOS=0x00 PREC=0x
авг 03 16:23:43 broadband CRON[5928]: pam_unix(cron:session): session closed for user root
авг 03 16:23:43 broadband /etc/init.d/mysql[7063]: 0 processes alive and ‘/usr/bin/mysqladmin —defaults-file=/etc/mysql/debian.cnf ping’ resulted in
авг 03 16:23:43 broadband /etc/init.d/mysql[7063]: [61B blob data]
авг 03 16:23:43 broadband mysql[6017]: …fail!
авг 03 16:23:43 broadband /etc/init.d/mysql[7063]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 «Connection refused»)’
авг 03 16:23:43 broadband /etc/init.d/mysql[7063]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
авг 03 16:23:43 broadband /etc/init.d/mysql[7063]:
авг 03 16:23:43 broadband systemd[1]: mysql.service: Control process exited, code=exited status=1
авг 03 16:23:43 broadband systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
— Subject: Ошибка юнита mysql.service
— Defined-By: systemd
— Support: lists.freedesktop.org/mailman/listinfo/systemd-devel

— Произошел сбой юнита mysql.service.

— Результат: failed.
авг 03 16:23:43 broadband systemd[1]: mysql.service: Unit entered failed state.
авг 03 16:23:43 broadband systemd[1]: mysql.service: Failed with result ‘exit-code’.
авг 03 16:23:43 broadband sudo[6000]: pam_unix(sudo:session): session closed for user root


  • Показать ещё
    Загружается…

25 июн. 2023, в 11:42

600 руб./за проект

25 июн. 2023, в 10:30

6000 руб./за проект

25 июн. 2023, в 10:26

15000 руб./за проект

Минуточку внимания

Console says

[root@ip-172-31-18-2 mysql]# service mysqld start
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with an error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

mysqld.service

[root@ip-172-31-18-2 mysql]# systemctl status mysqld.service
● mysqld.service - SYSV: MySQL database server.
   Loaded: loaded (/etc/rc.d/init.d/mysqld)
   Active: failed (Result: exit-code) since Sat 2017-02-18 20:59:17 IST; 36s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9925 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)

Feb 18 20:59:16 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Starting SYSV: MySQL database server....
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal mysqld[9925]: MySQL Daemon failed to start.
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal mysqld[9925]: Starting mysqld:  [FAILED]
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: mysqld.service: control process exited, code=exited status=1
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Failed to start SYSV: MySQL database server..
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.

What I have tried until now:

mysqld_safe --defaults-file=/etc/my.cf

chown -R mysql:mysql /var/lib/mysql

/etc/init.d/mysqld start

 /etc/init.d/mysqld stop

systemctl restart systemd-logind

rebooted the server

Still no luck.

my.cnf file

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for a dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Yilmaz's user avatar

Yilmaz

25.4k9 gold badges126 silver badges161 bronze badges

asked Feb 18, 2017 at 15:34

Nobi's user avatar

2

This amazingly worked.

/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld
/etc/init.d/mysql start
service mysql start

answered May 21, 2020 at 2:41

Yemi Orokotan's user avatar

7

I had the same error, the problem was because I no longer had disk space.
to check the space run this:

$ df -h

disk space

Then delete some files that you didn’t need.

After this commands:

service mysql start
systemctl status mysql.service
mysql -u root -p

After entering with the root password verify that the mysql service was active

answered Oct 18, 2019 at 5:12

juanitourquiza's user avatar

juanitourquizajuanitourquiza

2,0101 gold badge28 silver badges50 bronze badges

5

I met this problem today, and fix it with bellowed steps.

1, Check the log file /var/log/mysqld.log

tail -f /var/log/mysqld.log

 2017-03-14T07:06:53.374603Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
 2017-03-14T07:06:53.374614Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory

The log says that there isn’t a file or directory /var/run/mysqld/mysqld.pid

2, Create the directory /var/run/mysqld

mkdir -p /var/run/mysqld/

3, Start the mysqld again service mysqld start, but still fail, check the log again /var/log/mysqld.log

2017-03-14T07:14:22.967667Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2017-03-14T07:14:22.967678Z 0 [ERROR] Can't start server: can't create PID file: Permission denied

It saids permission denied.

4, Grant the permission to mysql
chown mysql.mysql /var/run/mysqld/

5, Restart the mysqld

# service mysqld restart
Restarting mysqld (via systemctl):                         [  OK  ]

Sineth Lakshitha's user avatar

answered Mar 14, 2017 at 7:24

Adam Deng's user avatar

Adam DengAdam Deng

3981 silver badge11 bronze badges

2

These are the steps I took to correct this:

Back up your my.cnf file in /etc/mysql and remove or rename it

sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak

Remove the folder /etc/mysql/mysql.conf.d/ using

sudo rm -r /etc/mysql/mysql.conf.d/

Verify you don’t have a my.cnf file stashed somewhere else (I did in my home dir!) or in /etc/alternatives/my.cnf use

sudo find / -name my.cnf

Now reinstall every thing

sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7
sudo apt install mysql-server

In case your syslog shows an error like «mysqld: Can’t read dir of ‘/etc/mysql/conf.d/’» create a symbolic link:

sudo ln -s /etc/mysql/mysql.conf.d /etc/mysql/conf.d

Then the service should be able to start with sudo service mysql start.

I hope it work

answered Jul 1, 2018 at 23:58

CJ-UNIq's user avatar

CJ-UNIqCJ-UNIq

1791 silver badge3 bronze badges

2

In my particular case, the error was appearing due to missing /var/log/mysql with mysql-server package 5.7.21-1 on Debian-based Linux distro. Having ran strace and sudo /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid ( which is what the systemd service actually runs), it became apparent that the issue was due to this:

2019-01-01T09:09:22.102568Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: No such file or directory

I’ve recently removed contents of several directories in /var/log so it was no surprise. The solution was to create the directory and make it owned by mysql user as in

$ sudo mkdir /var/log/mysql
$ sudo chown -R mysql:mysql /var/log/mysql

Having done that I’ve happily logged in via sudo mysql -u root and greeted with the old and familiar mysql> prompt

answered Jan 1, 2019 at 9:17

Sergiy Kolodyazhnyy's user avatar

6

if your problem not fix, you can try check more problem.

maybe mysql crash , like this :

you can check log in

sudo cat /var/log/mysql/error.log

or you check

sudo ls /var/crash

answered Oct 26, 2021 at 8:53

Bobi arip's user avatar

Bobi aripBobi arip

551 silver badge4 bronze badges

try

sudo chown mysql:mysql -R /var/lib/mysql

then start your mysql service

systemctl start mysqld

answered Mar 29, 2020 at 10:04

bobo's user avatar

1

the issue is with the «/etc/mysql/my.cnf». this file must be modified by other libraries that you installed. this is how it originally should look like:

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
    
!includedir /etc/mysql/mysql.conf.d/

answered Dec 15, 2020 at 13:57

Yilmaz's user avatar

YilmazYilmaz

25.4k9 gold badges126 silver badges161 bronze badges

I was also facing same issue .

root@*******:/root >mysql -uroot -password

mysql: [Warning] Using a password on the command line interface can be
insecure. ERROR 2002 (HY000): Can’t connect to local MySQL server
through socket ‘/var/lib/mysql/mysql.sock’ (2)

I found ROOT FS was also full and then I killed below lock session . 
root@**********:/var/lib/mysql >ls -ltr
total 0
-rw------- 1 mysql mysql 0 Sep  9 06:41 mysql.sock.lock

Finally Issue solved .

AAEM's user avatar

AAEM

1,8272 gold badges17 silver badges26 bronze badges

answered Sep 9, 2020 at 12:17

Uday's user avatar

  1. open my.cnf and copy the log-error path

  2. then check the permission for the copied log file using
    $ ls -l /var/log/mysql.log

  3. if any log file permission may changed from mysql:mysql, please change the file permission to
    $ chown -R mysql:mysql /var/log/mysql.log

  4. then restart the mysql server
    $ service mysql restart || systemctl restart mysqld

note: this kind of errors formed by the permission issues. all the mysql service start commands using the log file for writing the status of mysql. If the permission has been changed, the service can’t be write anything into the log files. If it happens it will stopped to run the service

answered Sep 11, 2020 at 9:21

Karthikeyan Ganesan's user avatar

remove any command of «secure_file_priv» in /etc/mysql/my.cnf and restart mysql.
If you want to use a file in mysql, copy those files to the main folder.
The main folder is obtained this way : SHOW VARIABLES LIKE "secure_file_priv";

answered Jan 28, 2021 at 1:39

Abolfazl Bayat's user avatar

You can purge all mysql-related packages and reinstall them with the following commands:

PACKAGES="mysql-server mysql-community-server mysql-community-server-core mysql-client mysql-client mysql-community-client mysql-community-client-core  mysql-common mysql-community-client-plugins php-mysql"
apt purge $PACKAGES
echo "any remaining installed packages:"
dpkg -l|grep ii|grep mysql
apt install --reinstall mysql-common
apt install $PACKAGES

If there are any remaining packages (apart from mysql-core), add those to your list

virteanchi's user avatar

answered Apr 27, 2021 at 16:30

rubo77's user avatar

rubo77rubo77

18.9k30 gold badges130 silver badges220 bronze badges

Backup your config or data and reinstall mysql

sudo apt remove --purge mysql-server
sudo apt purge mysql-server
sudo apt autoremove
sudo apt autoclean
sudo apt remove dbconfig-mysql


sudo apt-get remove --purge mysql* -y
sudo apt-get autoremove -y
sudo apt-get autoclean

Then install it again.

That works here.

answered Dec 8, 2021 at 13:02

Hedron Dantas's user avatar

Hedron DantasHedron Dantas

5792 gold badges5 silver badges16 bronze badges

i have got the same «systemctl status mysql.service» and «journalctl -xe» for details. ERROR.
after repeated deinstallation and installation does not work at all.
but this one work well> https://linuxtut.com/en/5a5b0f46620ae1b27b10/

you just need to remove everything from my.cnf file except [mysqld] and start the server. this really work. but you might not have the password for root in that case skip-grant-tables and restart server in safe mode and use mysql and
update mysql.user set authentication_string=null where user=’root’ and then can alter user ‘root’@’localhost’ identified by ‘your_$$new_99pwd#’;
then login to secure mode and then you can create new user.

answered Jan 1, 2022 at 11:58

Rajib hossen's user avatar

Also don’t forget to check on your docker containers, for me it was my docker has mysql running on the background.

answered Mar 22, 2022 at 8:50

Ahmad Jamil Al Rasyid's user avatar

  1. Connect to the server using SSH.

  2. Stop the affected MySQL service and the service plesk-web-socket to prevent it from attempting to start MySQL:

    service mysql stop || service mariadb stop && service plesk-web-socket stop
    
  3. Back up all the MySQL data storage files. By default, they are located in the directory /var/lib/mysql/.

    For example:

    cp -a /var/lib/mysql /root/mysql_backup
    
  4. Add the parameter innodb_force_recovery to the section [mysqld] of the MySQL configuration file. This option allows starting MySQL service in the recovery mode and try creating dumps of databases.

    For example:

    vi /etc/my.cnf
    [mysqld]
    innodb_force_recovery = 2
    
  5. Start the MySQL service.

Score_Under's user avatar

answered Aug 13, 2022 at 5:43

dineshsivalingam's user avatar

after having tested several solutions without success, the one that finally worked is the following:
you can load the default configuration of your apache server

sudo a2ensite 000-default.conf
sudo a2dissite my.conf
systemctl reload apache2

then reload the configuration for your website

sudo a2ensite my.conf
sudo a2dissite 000-default.conf
systemctl reload apache2

answered Sep 5, 2022 at 12:38

Franklin Tanemou's user avatar

I had the same issue and after hours the solution was for me:
Open this file nano /etc/mysql/my.cnf

#I use mysql service if you use mysqld service, type mysqld instead of mysql
[mysql]
innodb_force_recovery = 1

answered Oct 24, 2022 at 17:05

Kamuran Sönecek's user avatar

Kamuran SönecekKamuran Sönecek

3,3312 gold badges29 silver badges55 bronze badges

Had the same problem. Solved as given below.
Use command :

sudo tail -f /var/log/messages|grep -i mysql

to check if SELinux policy is causing the issue. If so, first check if SELinux policy is enabled using command #sestatus. If it shows enabled, then disable it.
To disable:

  1. # vi /etc/sysconfig/selinux
  2. change ‘SELINUX=enforcing’ to ‘SELINUX=disabled’
  3. restart linux
  4. check with sestatus and it should show «disabled»

Uninstall and reinstall mysql. It should be working.

Thomas Fritsch's user avatar

answered Dec 8, 2018 at 15:15

rajat saha's user avatar

rajat saharajat saha

1041 gold badge1 silver badge7 bronze badges

1

I am working with Ubuntu 18.04 and MySQL Server — 8.0.18

Suddenly today MySQL can’t start anymore

With the sudo service mysql status command appears:

sudo service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-11-02 17:05:23 -05; 1min 44s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1659 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 1620 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 1659 (code=exited, status=2)
   Status: "Server startup in progress"

Nov 02 17:05:22 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:05:22 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:05:22 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 9.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: Stopped MySQL Community Server.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Start request repeated too quickly.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.

With the sudo service mysql restart command appears:

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

Following and executing the two suggested commands:

  • systemctl status mysql.service
  • journalctl -xe

Therefore: sudo systemctl status mysql.service

sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-11-02 17:08:21 -05; 38s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2633 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 2594 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2633 (code=exited, status=2)
   Status: "Server startup in progress"

Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:20 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: Stopped MySQL Community Server.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Start request repeated too quickly.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.

And with journalctl -xe

-- Unit mysql.service has begun starting up.
Nov 02 17:08:20 asus2016-vb01 audit[2632]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld" pid=2632 comm="apparmor_p
Nov 02 17:08:20 asus2016-vb01 audit[2633]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/ssl/openssl.cnf" pid=2633 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122
Nov 02 17:08:20 asus2016-vb01 audit[2633]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2633/task/2634/mem" pid=2633 comm="mysqld" requested_mask="r" denied_mask="r" fsuid
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:20 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has failed.
-- 
-- The result is RESULT.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled

I followed the solution about this post:

  • Can’t start MySQL server (database corruption)

I used the innodb_force_recovery = 10 (ten), it playing, because with 1 and 2 did not work

Therefore with the sudo systemctl start mysql command is possible start the server.
I can see all the data and users saved in peace.

Now through the sudo systemctl status mysql command I get

sudo systemctl status mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-11-02 17:26:48 -05; 11s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2769 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2808 (mysqld)
   Status: "Server is operational"
    Tasks: 19 (limit: 4617)
   CGroup: /system.slice/mysql.service
           └─2808 /usr/sbin/mysqld

Nov 02 17:26:47 asus2016-vb01 systemd[1]: Starting MySQL Community Server...
Nov 02 17:26:48 asus2016-vb01 systemd[1]: Started MySQL Community Server.

Until this point would has no sense this post, but if I do either Alpha or Beta steps:

Alpha (steps): 
sudo systemctl stop mysql
remove innodb_force_recovery = 10
sudo systemctl start mysql         

Beta (steps):
restart the PC, 
(I can confirm `MySQL` was started), 
remove innodb_force_recovery = 10
restart the PC

the same problem happens again.

Therefore now is mandatory keep the innodb_force_recovery = 10, otherwise it returns to the same problem

Warning:

According with:

  • 15.21.2 Forcing InnoDB Recovery
  • Corrupt InnoDB: Start mysqld only innodb_force_recovery=6

The correct range is from 1 to 6, I am assuming 10 is «interpreted» how the maximum value (6)

Is there a way to configure something and remove innodb_force_recovery? It to return to the normal or old configuration where all worked fine (without innodb_force_recovery)

Note the final content of /var/log/mysql/error.log is

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2019-11-02T23:24:37.346875Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 1668
2019-11-02T23:24:37.804662Z 1 [ERROR] [MY-012671] [InnoDB] Encryption algorithm support missing: N
2019-11-02T23:24:37.804783Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: log0recv.cc:3563:err == DB_SUCCESS thread 139850038036224
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
23:24:37 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x555c74a041c0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f315fd6bce0 thread_stack 0x46000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x555c72ab2edd]
/usr/sbin/mysqld(handle_fatal_signal+0x303) [0x555c71b5bc63]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890) [0x7f317319a890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f31712d3e97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7f31712d5801]
/usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x2ec) [0x555c72d6015c]
/usr/sbin/mysqld(+0x2074038) [0x555c72c1d038]
/usr/sbin/mysqld(recv_recovery_from_checkpoint_start(log_t&, unsigned long)+0x660) [0x555c72c26e40]
/usr/sbin/mysqld(srv_start(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x1741) [0x555c72d0e701]
/usr/sbin/mysqld(+0x1fe3f25) [0x555c72b8cf25]
/usr/sbin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0x9f) [0x555c72868f5f]
/usr/sbin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0x5b4) [0x555c72a7d8f4]
/usr/sbin/mysqld(+0x1076dc5) [0x555c71c1fdc5]
/usr/sbin/mysqld(+0x24182b9) [0x555c72fc12b9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7f317318f6db]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f31713b688f]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

I am working with VirtualBox — Ubuntu is a guest. It had been working for more of 3 months, now suddenly this situation appeared.

More Info:

One

As requested desertangels

sudo /usr/sbin/mysqld
2019-11-03T00:07:06.466871Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 2307
2019-11-03T00:07:06.470277Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-11-03T00:07:06.472544Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-03T00:07:06.475967Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

Two

Executing cat /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
port            = 3307
bind-address    = 0.0.0.0
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
datadir     = /var/lib/mysql
log-error   = /var/log/mysql/error.log

Three

BTW: just in case, with mysql -u root -p appears:

mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Of course, the server is not running

#1 31.07.2018 16:24:16

deminart
Участник
Зарегистрирован: 31.07.2018
Сообщений: 2

Не поднимается база после обновления

Здравствуйте. Обновил mysql с версии 5.5.60 до 5.7.23 всё проработало минут 20-30, после чего mysql упал и больше не поднимался sad

journalctl -xe

июл 31 17:18:11 server01new systemd[1]: Failed to start MySQL Community Server.
— Subject: Ошибка юнита mysql.service
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Произошел сбой юнита mysql.service.

— Результат: failed.
июл 31 17:18:11 server01new systemd[1]: mysql.service: Unit entered failed state.
июл 31 17:18:11 server01new systemd[1]: mysql.service: Failed with result ‘exit-code’.
июл 31 17:18:12 server01new systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
июл 31 17:18:12 server01new systemd[1]: Stopped MySQL Community Server.
— Subject: Завершена остановка юнита mysql.service.
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Процесс остановки юнита mysql.service был завершен.
июл 31 17:18:12 server01new systemd[1]: Starting MySQL Community Server…
— Subject: Начинается запуск юнита mysql.service
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Начат процесс запуска юнита mysql.service.
июл 31 17:18:13 server01new mysqld[24651]: Unable to determine if daemon is running: No such file or directory
июл 31 17:18:13 server01new systemd[1]: mysql.service: Control process exited, code=exited status=1
июл 31 17:18:13 server01new systemd[1]: Failed to start MySQL Community Server.
— Subject: Ошибка юнита mysql.service
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Произошел сбой юнита mysql.service.

— Результат: failed.
июл 31 17:18:13 server01new systemd[1]: mysql.service: Unit entered failed state.
июл 31 17:18:13 server01new systemd[1]: mysql.service: Failed with result ‘exit-code’.
июл 31 17:18:14 server01new systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
июл 31 17:18:14 server01new systemd[1]: Stopped MySQL Community Server.
— Subject: Завершена остановка юнита mysql.service.
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Процесс остановки юнита mysql.service был завершен.
июл 31 17:18:14 server01new systemd[1]: Starting MySQL Community Server…
— Subject: Начинается запуск юнита mysql.service
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel

— Начат процесс запуска юнита mysql.service.

из error.log

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): Connection ID (thread ID): 0
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2018-07-31T13:00:28.381393Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use —explicit_defaults_for_timestamp server option (see documentation for more details).
2018-07-31T13:00:28.384851Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.23) starting as process 23226 …
2018-07-31T13:00:28.391094Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-07-31T13:00:28.391137Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-31T13:00:28.391150Z 0 [Note] InnoDB: Uses event mutexes
2018-07-31T13:00:28.391163Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-07-31T13:00:28.391175Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-07-31T13:00:28.391186Z 0 [Note] InnoDB: Using Linux native AIO
2018-07-31T13:00:28.391628Z 0 [Note] InnoDB: Number of pools: 1
2018-07-31T13:00:28.391798Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2018-07-31T13:00:28.394255Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-07-31T13:00:28.410889Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-07-31T13:00:28.413520Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-07-31T13:00:28.427707Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-07-31T13:00:28.429142Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 283496662954
2018-07-31T13:00:28.641987Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 283498490526
2018-07-31T13:00:28.646159Z 0 [Note] InnoDB: Database was not shutdown normally!
2018-07-31T13:00:28.646176Z 0 [Note] InnoDB: Starting crash recovery.
2018-07-31T13:00:28.730604Z 0 [Note] InnoDB: Starting an apply batch of log records to the database…
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2018-07-31T13:00:29.328707Z 0 [Note] InnoDB: Apply batch completed
2018-07-31T13:00:29.441067Z 0 [Note] InnoDB: Removed temporary tablespace data file: «ibtmp1»
2018-07-31T13:00:29.441103Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-07-31T13:00:29.441183Z 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
2018-07-31T13:00:29.619329Z 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
2018-07-31T13:00:29.621086Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-07-31T13:00:29.621107Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-07-31T13:00:29.622326Z 0 [Note] InnoDB: 5.7.23 started; log sequence number 283498490526
2018-07-31T13:00:29.622805Z 0 [Note] Plugin ‘FEDERATED’ is disabled.
2018-07-31T13:00:29.623458Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-07-31T13:00:29.629047Z 0 [Warning] System table ‘plugin’ is expected to be transactional.
2018-07-31 17:00:29 0x9acf9b40  InnoDB: Assertion failure in thread 2597296960 in file os0file.cc line 1699
InnoDB: Failing assertion: offset > 0
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/ … overy.html
InnoDB: about forcing recovery.
13:00:29 UTC — mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67527 K  bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x9dd00468
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong…
stack_bottom = 9acf92bc thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x28)[0x8a82c18]
/usr/sbin/mysqld(handle_fatal_signal+0x406)[0x83a7dd6]
linux-gate.so.1(__kernel_sigreturn+0x0)[0xb77bfd2c]
linux-gate.so.1(__kernel_vsyscall+0x9)[0xb77bfd21]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(gsignal+0x47)[0xb745b367]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(abort+0x143)[0xb745ca23]
/usr/sbin/mysqld[0x837dc2f]
/usr/sbin/mysqld[0x8c0d9bb]
/usr/sbin/mysqld[0x8c0df86]
/usr/sbin/mysqld[0x8c0e0b0]
2018-07-31T13:00:29.637144Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2018-07-31T13:00:29.637199Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
/usr/sbin/mysqld[0x8c13076]
/usr/sbin/mysqld(_Z17os_file_read_funcR9IORequestiPvym+0x21)[0x8c133d1]
/usr/sbin/mysqld(_Z11os_aio_funcR9IORequestmPKc13pfs_os_file_tPvymbP10fil_node_tS4_+0x176)[0x8c13cd6]
/usr/sbin/mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0xb63)[0x8def083]
2018-07-31T13:00:29.642551Z 0 [Warning] CA certificate ca.pem is self signed.
/usr/sbin/mysqld(_Z13buf_read_pageRK9page_id_tRK11page_size_t+0xc6)[0x8d9c666]
/usr/sbin/mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x314)[0x8d69b84]
/usr/sbin/mysqld(_Z19xdes_get_descriptormmRK11page_size_tP5mtr_t+0x1f2)[0x8df4712]
/usr/sbin/mysqld[0x8df7753]
/usr/sbin/mysqld(_Z14fseg_free_pagePhmmbP5mtr_t+0x1bb)[0x8df904b]
/usr/sbin/mysqld(_Z17btr_page_free_lowP12dict_index_tP11buf_block_tmP5mtr_t+0x65)[0x8d337a5]
/usr/sbin/mysqld(_Z13btr_page_freeP12dict_index_tP11buf_block_tP5mtr_t+0x32)[0x8d33822]
/usr/sbin/mysqld(_Z12btr_compressP9btr_cur_tmP5mtr_t+0xc63)[0x8d3b4c3]
/usr/sbin/mysqld(_Z26btr_cur_compress_if_usefulP9btr_cur_tmP5mtr_t+0x199)[0x8d47fc9]
/usr/sbin/mysqld(_Z26btr_cur_pessimistic_deleteP7dberr_tmP9btr_cur_tmbP5mtr_t+0x433)[0x8d4b543]
2018-07-31T13:00:29.662547Z 0 [Note] Server hostname (bind-address): ‘127.0.0.1’; port: 3306
2018-07-31T13:00:29.662582Z 0 [Note]   — ‘127.0.0.1’ resolves to ‘127.0.0.1’;
2018-07-31T13:00:29.662675Z 0 [Note] Server socket created on IP: ‘127.0.0.1’.
2018-07-31T13:00:29.662950Z 0 [Warning] Failed to open optimizer cost constant tables

/usr/sbin/mysqld[0x8c919c1]
/usr/sbin/mysqld(_Z14row_purge_stepP9que_thr_t+0x41e)[0x8c936be]
/usr/sbin/mysqld(_Z15que_run_threadsP9que_thr_t+0xa18)[0x8c3fa28]
/usr/sbin/mysqld(srv_worker_thread+0x476)[0x8cc6516]
/lib/i386-linux-gnu/i686/cmov/libpthread.so.0(+0x6ecb)[0xb7786ecb]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(clone+0x5e)[0xb7518d0e]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): Connection ID (thread ID): 0
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

UPD: Запустил через

[mysqld]
innodb_force_recovery = 2

Сейчас вопрос в том, что послужило причиной падения? Какая-то база?

Отредактированно deminart (31.07.2018 19:15:48)

Неактивен

#2 31.07.2018 23:03:20

paulus
Администратор
MySQL Authorized Developer and DBA
Зарегистрирован: 22.01.2007
Сообщений: 6740

Re: Не поднимается база после обновления

Причина последнего падения, очевидно, в побившихся файлах. А вот почему они побились — это предыдущее падение, оно действительно очень интересно, и оно должно быть в error.log немного ранее.

Неактивен

#3 01.08.2018 06:51:58

deminart
Участник
Зарегистрирован: 31.07.2018
Сообщений: 2

Re: Не поднимается база после обновления

paulus написал:

Причина последнего падения, очевидно, в побившихся файлах. А вот почему они побились — это предыдущее падение, оно действительно очень интересно, и оно должно быть в error.log немного ранее.

Спасибо за ответ. Возможную причину поищу на досуге в бекапах лога. А так, решил сейчас не искать в какой именно базе была проблема, удалил и перелазил все базы из дампа.

Напишу что сделал, вдруг кому-нибудь пригодится, хотя аналогичных проблем и их решений полно, и тут естественно тожеsmile https://sqlinfo.ru/forum/viewtopic.php?id=7589

Остановил mysql.

В my.cnf прописал
innodb_force_recovery = 2 (минимально возможный  режим в котором у меня стартануло)
innodb_purge_threads = 0

Сделал дамп (ещё до обновления), так же скопировал каталоги /etc/mysql/ /var/lib/mysql/

Из каталога /var/lib/mysql удалил все папки кроме mysql и performance_schema, файлы ib_logfile* и ibdata* удалить тоже.

Убрал из my.cnf.
innodb_force_recovery = 2
innodb_purge_threads = 0

Запустил mysql

Ну и собственно импорт
mysqldump -u root -p —all-databases > /locate/all-databases.sql

Далее перезапустил mysql и апач

з.ы. Поправьте пожалуйста, если что-то сделал не правильно, будет полезно на ошибках поучится…

Сейчас всё вроде нормально… Проверю на ошибки, почитаю логи и помониторю как себя будет вести…

з.ы.2 Сейчас в логах в основном валится innodb table mysql . innodb_table_stats not found насколько я понял нужно ещё сделать  mysql_upgrade -u root -p…

Так же обновил привилегии…

В phpmyadmin валится: Native table ‘performance_schema’.’session_variables’ has the wrong structure, видимо ещё нужно сделать рестарт, после апгрейда…

Отредактированно deminart (01.08.2018 09:43:29)

Неактивен

Приветствую!
Уже неделю пытаюсь перенести базу MySQL в директорию /home/sas но ничерта не получается  :angry:
Порядок действий:
останавливаю MySQL:

sudo service mysql stop
перемещаю базы в требуемую директорию:

sudo mv /var/lib/mysql /home/sas
и вот тут начинается самое интересное. Во многих мануалах пишут

ЦитироватьМеняем в файле конфигурации местоположение базы,
для этого открываем файл /etc/mysql/my.cnf,
находим в нем строчку:
datadir = /var/lib/mysql  и меняем в ней путь на новый:

Но загвоздка в том, что datadir не существует! Ладно, создаю и в итоге получаю такой файл (закомментированные строки пропустил):

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
datadir = /home/sas/mysql

проверяю права на папку и вижу, что все в порядке:

drwx------  6 mysql mysql  4096 май 23 11:40 mysql

они 700, и пользователь:группа mysql:mysql — все ок.
Теперь запускаю MySQL:

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.

При команде

systemctl status mysql.service
получаю:


● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
   Active: inactive (dead) (Result: exit-code) since Вт 2017-05-23 12:13:31 MSK;
  Process: 2161 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=ex
  Process: 2160 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
  Process: 2678 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
Main PID: 2160 (code=exited, status=0/SUCCESS)

май 23 12:13:31 k43e systemd[1]: mysql.service: Unit entered failed state.
май 23 12:13:31 k43e systemd[1]: mysql.service: Failed with result 'exit-code'.
май 23 12:13:31 k43e systemd[1]: mysql.service: Service hold-off time over, sche
май 23 12:13:31 k43e systemd[1]: Stopped MySQL Community Server.
май 23 12:13:31 k43e systemd[1]: mysql.service: Start request repeated too quick
май 23 12:13:31 k43e systemd[1]: Failed to start MySQL Community Server.

а при команде

journalctl -xe получаю:


май 23 12:13:31 k43e systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
май 23 12:13:31 k43e systemd[1]: Stopped MySQL Community Server.
-- Subject: Завершена остановка юнита mysql.service.
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Процесс остановки юнита mysql.service был завершен.
май 23 12:13:31 k43e systemd[1]: mysql.service: Start request repeated too quickly.
май 23 12:13:31 k43e systemd[1]: Failed to start MySQL Community Server.
-- Subject: Ошибка юнита mysql.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита mysql.service.
--
-- Результат: failed.
май 23 12:13:49 k43e dhclient[1041]: DHCPREQUEST of 192.168.0.102 on wlp2s0 to 192.168.0.100 port 67 (xid=0x749eab50)
май 23 12:13:49 k43e dhclient[1041]: DHCPACK of 192.168.0.102 from 192.168.0.100
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3843]   address 192.168.0.102
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3844]   plen 24 (255.255.255.0)
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3844]   gateway 192.168.0.100
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3845]   server identifier 192.168.0.100
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3845]   lease time 600
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3845]   nameserver '192.168.0.100'
май 23 12:13:49 k43e NetworkManager[691]: <info>  [1495530829.3846] dhcp4 (wlp2s0): state changed bound -> bound
май 23 12:13:49 k43e dbus[679]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
май 23 12:13:49 k43e systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: Начинается запуск юнита NetworkManager-dispatcher.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Начат процесс запуска юнита NetworkManager-dispatcher.service.
май 23 12:13:49 k43e dbus[679]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
май 23 12:13:49 k43e systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: Запуск юнита NetworkManager-dispatcher.service завершен
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Процесс запуска юнита NetworkManager-dispatcher.service был завершен.
--
-- Результат: done.
май 23 12:13:49 k43e nm-dispatcher[2691]: req:1 'dhcp4-change' [wlp2s0]: new request (1 scripts)
май 23 12:13:49 k43e nm-dispatcher[2691]: req:1 'dhcp4-change' [wlp2s0]: start running ordered scripts...
май 23 12:13:49 k43e dhclient[1041]: bound to 192.168.0.102 -- renewal in 250 seconds.
май 23 12:17:01 k43e CRON[2721]: pam_unix(cron:session): session opened for user root by (uid=0)
май 23 12:17:01 k43e CRON[2722]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
май 23 12:17:01 k43e CRON[2721]: pam_unix(cron:session): session closed for user root

Что-то мне подсказывает, что трабл с файлом /etc/mysql/my.cnf, что там отсутствовала datadir
Знает кто в чем трабл?

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS


Цитата: sasha300 от мая 23, 2017, 15:24:46
и в итоге получаю такой файл (закомментированные строки пропустил):
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
datadir = /home/sas/mysql

это у вас всего три строки в конфиге /etc/mysql/my.cnf ?


да, всего-лишь 3 строчки. Все остальные закомментированные строки не приводил

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS



В файле /etc/mysql/mysql.conf.d/mysqld.cnf действительно содержалась директива datadir
Нужно поменять путь к базе MySQL, т.е. надо заменить 

datadir = /var/lib/mysql на

datadir = /home/sas/mysql
В итоге файл принял следующий вид (привожу со всеми закомментированными строками):


#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /home/sas/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size   = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem


Затем пробую стартануть MySQL, но опять вываливается ошибка:


sas@k43e:~$ 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.

При наборе systemctl status mysql.service получаю:


mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Ср 2017-05-24 11:19:27 MSK; 15s ago
  Process: 3958 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 3951 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 3958 (code=exited, status=1/FAILURE);         : 3959 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─3959 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─4004 sleep 1

май 24 11:19:27 k43e systemd[1]: Starting MySQL Community Server...
май 24 11:19:28 k43e systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE


Теперь вылезает только одна ошибка, типа «mysql.service: главный процесс истек», как победить трабл?
p.s: может сокет mysqld.sock должен быть не в директории /var/run/mysqld/, а в /home/sas/mysql ?

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS



Разобрался. В инструкции https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-16-04 сказано:

Цитировать
We’ll need to tell AppArmor to let MySQL write to the new directory by creating an alias between the default directory and the new location. To do this, edit the AppArmor alias file:
sudo nano /etc/apparmor.d/tunables/alias
At the bottom of the file, add the following alias rule:
/etc/apparmor.d/tunables/alias
. . .
alias /var/lib/mysql/ -> /mnt/volume-nyc1-01/mysql/,

Ну я там добавил строчку:

alias /var/lib/mysql/ -> /home/sas/mysql/,
Затем

sudo systemctl restart apparmor
и

sudo service mysql start
Сам не поверил  :smile:
Когда успешно зашел в phpmyadmin, то понял, что все нормуль
Сегодня Клонзиллой опять бахну систему до изначального состояния и последовательно пройдусь во всем пунктам, дабы понять, что последовательность действий правильна.

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS


Но тогда пару вопросов:
1. Почему в большинстве инструкций написано, что надо менять файл /etc/mysql/my.cnf (который, кстати, линкованный и ведет к /etc/alternatives/my.cnf),  а по факту надо было менять /etc/mysql/mysql.conf.d/mysqld.cnf ?
2. Зачем нужен сокет? Эта типа дамп/swap файл для MySQL? Ничего, что он создается в /var/run/mysqld, а сам MySQL в /home/sas/mysql?

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS


1. Потому что раньше (в Ubuntu 14.04 например) конфигурационный файл находился именно там. А в 16.04 в этом файле указаны ссылки на каталог /etc/mysql/mysql.conf.d/. Всё течёт, всё изменяется.
2. Сокет (программный интерфейс)


Только что опять повторил все шаги на новой Xubuntu — базы MySQL замечательно перенеслись. oermolaev спасибо за подсказки!

дом: Xubuntu 18.04 LTS
работа: Xubuntu 16.04 LTS


i have been stuck on this for days now. When i run service mysql start
it returns this:

matthew@matthewserver:~$ service mysql start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'mysql.service'.
Authenticating as: matthew tranmer (matthew)
Password:
==== AUTHENTICATION COMPLETE ===
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

When i run journalctl -xe:

-- Unit mysql.service has begun starting up.
Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: ERROR: Unable to start MySQL server:
Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: 2018-10-02T16:32:27.849609Z 0 [ERROR] unknown variable 'key_buffer=16M'
Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: 2018-10-02T16:32:27.857580Z 0 [ERROR] Aborting
Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: Once the problem is resolved, restart the service.
Oct 02 16:32:27 matthewserver systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 02 16:32:27 matthewserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 16:32:27 matthewserver systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Oct 02 16:32:28 matthewserver systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Start request repeated too quickly.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 16:32:28 matthewserver systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.

and when i run systemctl status mysql.service i get:

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-10-02 16:32:28 UTC; 2min 33s ago
  Process: 28760 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
  Process: 31599 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

Oct 02 16:32:27 matthewserver mysql-systemd-start[31599]: Once the problem is resolved, restart the service.
Oct 02 16:32:27 matthewserver systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 02 16:32:27 matthewserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 16:32:27 matthewserver systemd[1]: Failed to start MySQL Community Server.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Oct 02 16:32:28 matthewserver systemd[1]: Stopped MySQL Community Server.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Start request repeated too quickly.
Oct 02 16:32:28 matthewserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 16:32:28 matthewserver systemd[1]: Failed to start MySQL Community Server.

This happens when i run sudo mysql

matthew@matthewserver:~$ sudo mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I do not know what to do to get it working, this is kinda a last resort.

After rebooting server, I can’t start mysql again

I received this message:

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

I tried journalctl -xe and received this

-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Unit entered failed state.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 06 21:25:57 myserver systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Nov 06 21:25:57 myserver systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Nov 06 21:25:58 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

here is the result for systemctl status mysql.service

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Sun 2016-11-06 21:29:00 UTC; 21s ago
  Process: 4563 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 4560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 4563 (code=exited, status=1/FAILURE);         : 4566 (mysql-systemd-s)
    Tasks: 2
   Memory: 320.0K
      CPU: 400ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─4566 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─4625 sleep 1

Nov 06 21:29:00 myserver systemd[1]: Starting MySQL Community Server...
Nov 06 21:29:01 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

Please help ! Thank you!

I am working with Ubuntu 18.04 and MySQL Server — 8.0.18

Suddenly today MySQL can’t start anymore

With the sudo service mysql status command appears:

sudo service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-11-02 17:05:23 -05; 1min 44s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1659 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 1620 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 1659 (code=exited, status=2)
   Status: "Server startup in progress"

Nov 02 17:05:22 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:05:22 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:05:22 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 9.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: Stopped MySQL Community Server.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Start request repeated too quickly.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:05:23 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.

With the sudo service mysql restart command appears:

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

Following and executing the two suggested commands:

  • systemctl status mysql.service
  • journalctl -xe

Therefore: sudo systemctl status mysql.service

sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-11-02 17:08:21 -05; 38s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2633 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 2594 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2633 (code=exited, status=2)
   Status: "Server startup in progress"

Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:20 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: Stopped MySQL Community Server.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Start request repeated too quickly.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.

And with journalctl -xe

-- Unit mysql.service has begun starting up.
Nov 02 17:08:20 asus2016-vb01 audit[2632]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld" pid=2632 comm="apparmor_p
Nov 02 17:08:20 asus2016-vb01 audit[2633]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/ssl/openssl.cnf" pid=2633 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122
Nov 02 17:08:20 asus2016-vb01 audit[2633]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2633/task/2634/mem" pid=2633 comm="mysqld" requested_mask="r" denied_mask="r" fsuid
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 02 17:08:20 asus2016-vb01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 02 17:08:20 asus2016-vb01 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has failed.
-- 
-- The result is RESULT.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 02 17:08:21 asus2016-vb01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled

I followed the solution about this post:

  • Can’t start MySQL server (database corruption)

I used the innodb_force_recovery = 10 (ten), it playing, because with 1 and 2 did not work

Therefore with the sudo systemctl start mysql command is possible start the server.
I can see all the data and users saved in peace.

Now through the sudo systemctl status mysql command I get

sudo systemctl status mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-11-02 17:26:48 -05; 11s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2769 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2808 (mysqld)
   Status: "Server is operational"
    Tasks: 19 (limit: 4617)
   CGroup: /system.slice/mysql.service
           └─2808 /usr/sbin/mysqld

Nov 02 17:26:47 asus2016-vb01 systemd[1]: Starting MySQL Community Server...
Nov 02 17:26:48 asus2016-vb01 systemd[1]: Started MySQL Community Server.

Until this point would has no sense this post, but if I do either Alpha or Beta steps:

Alpha (steps): 
sudo systemctl stop mysql
remove innodb_force_recovery = 10
sudo systemctl start mysql         

Beta (steps):
restart the PC, 
(I can confirm `MySQL` was started), 
remove innodb_force_recovery = 10
restart the PC

the same problem happens again.

Therefore now is mandatory keep the innodb_force_recovery = 10, otherwise it returns to the same problem

Warning:

According with:

  • 15.21.2 Forcing InnoDB Recovery
  • Corrupt InnoDB: Start mysqld only innodb_force_recovery=6

The correct range is from 1 to 6, I am assuming 10 is «interpreted» how the maximum value (6)

Is there a way to configure something and remove innodb_force_recovery? It to return to the normal or old configuration where all worked fine (without innodb_force_recovery)

Note the final content of /var/log/mysql/error.log is

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2019-11-02T23:24:37.346875Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 1668
2019-11-02T23:24:37.804662Z 1 [ERROR] [MY-012671] [InnoDB] Encryption algorithm support missing: N
2019-11-02T23:24:37.804783Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: log0recv.cc:3563:err == DB_SUCCESS thread 139850038036224
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
23:24:37 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x555c74a041c0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f315fd6bce0 thread_stack 0x46000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x555c72ab2edd]
/usr/sbin/mysqld(handle_fatal_signal+0x303) [0x555c71b5bc63]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890) [0x7f317319a890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f31712d3e97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7f31712d5801]
/usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x2ec) [0x555c72d6015c]
/usr/sbin/mysqld(+0x2074038) [0x555c72c1d038]
/usr/sbin/mysqld(recv_recovery_from_checkpoint_start(log_t&, unsigned long)+0x660) [0x555c72c26e40]
/usr/sbin/mysqld(srv_start(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x1741) [0x555c72d0e701]
/usr/sbin/mysqld(+0x1fe3f25) [0x555c72b8cf25]
/usr/sbin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0x9f) [0x555c72868f5f]
/usr/sbin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0x5b4) [0x555c72a7d8f4]
/usr/sbin/mysqld(+0x1076dc5) [0x555c71c1fdc5]
/usr/sbin/mysqld(+0x24182b9) [0x555c72fc12b9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7f317318f6db]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f31713b688f]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

I am working with VirtualBox — Ubuntu is a guest. It had been working for more of 3 months, now suddenly this situation appeared.

More Info:

One

As requested desertangels

sudo /usr/sbin/mysqld
2019-11-03T00:07:06.466871Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 2307
2019-11-03T00:07:06.470277Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-11-03T00:07:06.472544Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-03T00:07:06.475967Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

Two

Executing cat /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
port            = 3307
bind-address    = 0.0.0.0
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
datadir     = /var/lib/mysql
log-error   = /var/log/mysql/error.log

Three

BTW: just in case, with mysql -u root -p appears:

mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Of course, the server is not running

  • Ошибка юнита mariadb service
  • Ошибка юнита kesl supervisor service
  • Ошибка юнита httpd service
  • Ошибка юбисофт не удалось установить владельца данного продукта
  • Ошибка юбисофт гейм лаунчер код ошибки 2 герои 6