I restarted my server because it froze (probably the stupidest thing I did so far) and then got some internal server errors. I soon discovered that mysql had failed on startup (service mysql status).
I read the mysql error log( Pastebin ) and started googling.
I’m running Ubuntu at its latest version, mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper.
What I tried:
- deleting both ib_logfile (after doing a backup) in /var/lib/mysql
- apt-get upgrade (I really don’t know why)
-checking my.cf for errors
Here is my /var/log/mysql/error.log
2020-08-07T15:43:06.094116Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-07T15:43:06.095903Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31-0ubuntu0.18.04.1) starting as process 952 ...
2020-08-07T15:43:06.100450Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-08-07T15:43:06.100482Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-08-07T15:43:06.100489Z 0 [Note] InnoDB: Uses event mutexes
2020-08-07T15:43:06.100496Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-08-07T15:43:06.100502Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-08-07T15:43:06.100508Z 0 [Note] InnoDB: Using Linux native AIO
2020-08-07T15:43:06.100771Z 0 [Note] InnoDB: Number of pools: 1
2020-08-07T15:43:06.100876Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-08-07T15:43:06.102827Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-08-07T15:43:06.112754Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-08-07T15:43:06.114871Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-08-07T15:43:06.127135Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-08-07T15:43:06.128655Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 7945493345
2020-08-07T15:43:06.128723Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 7945545114
2020-08-07T15:43:06.130551Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 7945493345 and the end 7945545114.
2020-08-07T15:43:06.130573Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-08-07T15:43:06.732437Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-08-07T15:43:06.732470Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-08-07T15:43:06.732482Z 0 [ERROR] Failed to initialize builtin plugins.
2020-08-07T15:43:06.732491Z 0 [ERROR] Aborting
2020-08-07T15:43:06.732526Z 0 [Note] Binlog end
2020-08-07T15:43:06.732586Z 0 [Note] Shutting down plugin 'CSV'
2020-08-07T15:43:06.732959Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
If you need more logs/informations, I will provide them.
Thanks, I’m really desperate, I really don’t want to loose the past 2 years of my life.
Симптомы в логе MySQL такие:
[ERROR] InnoDB: Invalid redo log header checksum. [ERROR] InnoDB: Plugin initialization aborted with error Generic error
Способ 1: быстро и должно помочь
Основано на [5].
Делаем бекап (apt-btrfs-snapshot snapshot
).
В /etc/mysql/my.cnf
поставить innodb_force_recovery = 6
systemctl restart mysql
mysqldump -AER > /root/recovery_dump.sql systemctl stop mysql mkdir -p /root/mysql-ibd-bak/ mv /var/lib/mysql/ibdata* /root/mysql-ibd-bak/ mv /var/lib/mysql/ib_log* /root/mysql-ibd-bak/
В /etc/mysql/my.cnf
закомментировать innodb_force_recovery = 6
, systemctl restart mysql
После этого заработало.
mysql < /root/recovery_dump.sql
не понадобилось, оно просто ругнулось на уже существующую БД.
Способ 2: хардкор, ничего не помогает
Переходим в root-режим: sudo -i
или su -
. Все дальнейшие действия выполняютсмя от root.
Вносим в конфиг MySQL (/etc/mysql/my.cnf
на Ubuntu и /etc/my.cnf
на CentOS) строку:
innodb_force_recovery = 6
Перезапускаем MySQL: systemctl restart mysql
. Он должен запуститься, но базы данных буду в режиме только чтения.
Снимаем дампы или просто удаляем поврежденные базы, если это тестовые.
Просто удалить все базы будет мало для полного восстановления, поэтому удаляем вообще все (убедитесь, что есть рабочие бекапы! рекомендую снапшоты BTRFS), сначала остановив MySQL:
systemctl stop mysql
rm -fvr /var/lib/mysql/*
Делаем заново начальную инициализацию:
mysqld --initialize
И перезапускаем MySQL:
systemctl restart mysql
Убеждаемся, что он запустился! (systemctl status mysql
)
Останаливаем MySQL:
systemctl stop mysql
Теперь нужно установить новый root-пароль внутри MySQL.
Запустим MySQL в безопасном режиме, чтобы он позволил нам войти в управлением им без знания root-пароля:
mkdir /var/run/mysql chown -R mysql:mysql /var/run/mysql mysqld_safe --skip-grant-tables --skip-networking &
(нажимаем клавишу Enter несколько раз, если нет запроса командной строки)
Вы должны увидеть сообщение, свидетельствующее об успешном запуске:
2018-07-31T20:38:44.962048Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Создаем новый рандомный root-пароль:
pass="$(cat /dev/urandom | head -n 2 | md5sum | awk '{print $1}')"
Выводим этот новый пароль, копируем его в буфер обмена для дальнейшей вставки:
echo "$pass"
Далее входим в консоль MySQL и выполняем установку нового root-пароля:
# mysql -u root > use mysql; > update user set authentication_string=password('вставить_новый_пароль') where user='root'; > flush privileges; > quit;
# mysql -u root > FLUSH PRIVILEGES; > ALTER USER 'root'@'localhost' IDENTIFIED BY 'вставить_новый_пароль'; > exit
Убиваем запущенный в безопасном режиме MySQL:
pkill mysqld
Далее, если используется панель управления Vesta, то нам нужно в ее конфиги записать новый пароль от MySQL, чтобы не было ошибки «Error: Connection to localhost failed» при попытке управлять базами данных через Vesta. Для этого нужно заменить старый пароль на новый путем редактировавания в обычном текстовом редакторе двух файлов: /root/.my.cnf
и /usr/local/vesta/conf/mysql.conf
.
Теперь запускаем MySQL:
systemctl restart mysql
Командой systemctl status mysql
убеждаемся, что он запустился:
Теперь пробуем в Vesta создать новую базу данных и убеждаемся, что это получилось сделать.
Источники и прочие полезные ссылки:
[1] https://www.techrepublic.com/article/how-to-set-change-and-recover-a-mysql-root-password/
[2] https://forum.vestacp.com/viewtopic.php?p=69952#p69952
[3] http://www.mysql.ru/docs/man/Resetting_permissions.html
[4] https://bugs.mysql.com/bug.php?id=84191
[5] https://forums.cpanel.net/resources/innodb-corruption-repair-guide.395/
After update to 2.3.0.2 docker container cannot working correctly
Expected behavior
- create folder db em run mariadb container with docker-compose up
Actual behavior
- database container exited with code 1
Information
My docker-compose file
db:
image: mariadb:10.3.22
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
MYSQL_USER: root
MYSQL_PASSWORD: root
volumes:
- ./db:/var/lib/mysql
I tried other ways to find it here, but none works correctly, before the update was working like this perfectly, tested on another windows 10 machine, with docker and the same problem occurs
without specifying the volume works correctly
LOG ERROR:
2020-05-12 14:41:31 0 [ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 38
db_1 | 2020-05-12 14:41:31 0 [ERROR] InnoDB: Could not set the file size of ‘./ibdata1’. Probably out of disk space
db_1 | 2020-05-12 14:41:31 0 [ERROR] InnoDB: Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
db_1 | 2020-05-12 14:41:32 0 [ERROR] Plugin ‘InnoDB’ init function returned error.
db_1 | 2020-05-12 14:41:32 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
- Windows Version: 10
- Docker Desktop Version: 2.3.0.2
Steps to reproduce the behavior
- Open Powershell and Create a directory «mkdir teste»
- Create docker-compose.yml
- Paste
version: '3.3'
services:
db:
image: mariadb:10.3.22
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: covid
MYSQL_DATABASE: plataformasaude
MYSQL_USER: plataformasaude
MYSQL_PASSWORD: covid
volumes:
- ./db:/var/lib/mysql
- Run docker-compose up
0
1
Пытаюсь войти в личный кабинет а не получается захожу вот по
этому адресу => 127.0.0.1/phpmyadmin
ввожу username => root
ввожу password => root
ошибка вот => https://i.ibb.co/McBnQP3/screen.png
в /var/log/mysql была ошибка типа => [ERROR] InnoDB: Plugin initialization aborted with error Generic error
Я решил эту проблемы зашел в /etc/mysql/my.cnf и сделал коммент строчка => tmpdir
ошибка исправилось ну вход в личный кабинет не удался
/var/log/mysql пуст
установил в my.cnf логин и пароль
[client]
user=root
password=root
Перезапустил mysql службу и опять не удается войти и ввожу логин root и пароль root
Пытался установить пароль командой => mysqladmin -u root password ‘root’
и ничего не выходит пытался войти в mysql от имени root и ошибка входа
как можно исправить ошибку входа ?
=> my.cnf
# /etc/mysql/my.cnf: The global mysql configuration file.
[client]
user=root
password=root
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
#tmpdir = /tmp
language = /usr/share/mysql/english
old_passwords = 0
bind-address = 127.0.0.1[]br
skip-external-locking
max_allowed_packet = 16M
key_buffer_size = 16M
innodb_buffer_pool_size = 512M
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
max_connections = 132
query_cache_size = 0
slow_query_log = /var/log/mysql/mysql-slow.log
long_query_time = 1
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
!includedir /etc/mysql/mysql.d
I’m getting the following errors after running sudo mysqld_safe --skip-grant-tables
on my Ubuntu Desktop (my PC, no a server):
2019-03-11T09:43:13.463024Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
2019-03-11T09:46:23.705247Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 3141
2019-03-11T09:46:23.717873Z 1 [ERROR] [MY-012935] [InnoDB] Database upgrade cannot be accomplished in read-only mode.
2019-03-11T09:46:23.717884Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2019-03-11T09:46:23.717906Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2019-03-11T09:46:23.718040Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-03-11T09:46:23.718101Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-03-11T09:46:23.718366Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
This is how my.cnf
looks like:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
innodb_force_recovery = 6
innodb_buffer_pool_size = 10M
innodb_buffer_pool_size = 10M
innodb_log_file_size = 1000M
I already backed up the /var/lib/mysql
directory which contains the important data, but I would like to make a mysql dump as well.
How can I start the mysql server in a minimal way so that I can export the databases?
I preinstalled Oracle Enteprise Linux and it automatically installed Mysql Community 5.1. But I wanna update it to 8.
After update the daemon won’t start and the /var/log/mysqld.log shows that
[ERROR] [MY-012263] [InnoDB] The Auto-extending innodb_system data file ‘./ibdata1’ is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
Then I change the /etc/my.cnf file and add
innodb_data_file_path = ibdata1:10M:autoextend
I tried to start it again and the log file said
[ERROR] [InnoDB] Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
because if that, I moved the /var/lib/mysql/ib_logfile* to backup directory and try to start mysqld again.
BUT it still won’t start because the log file said
[ERROR] [MY-012960] [InnoDB] Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
[ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
[ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
[ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
[ERROR] [MY-010119] [Server] Aborting
Any help would be appreciated.
asked Aug 23, 2019 at 2:57
That is a gynormous upgrade.
Plan A: Oracle recommends doing it in 4 steps 5.1 -> 5.5 -> 5.6 -> 5.7 -> 8.0. And, at each step, run mysql_upgrade.
Plan B: Alternatively, you could dump the data and hope that the reload doesn’t find some syntax errors.
I fear that you may have already hosed the files too much to have a successful upgrade.
answered Aug 23, 2019 at 5:08
Rick JamesRick James
72.9k4 gold badges41 silver badges101 bronze badges
2
For the solution, I reinstall it completely with
yum remove -y mysql mysql-server
rm -rf /var/lib/mysql/ #to make sure it completely deleted
yum install mysql mysql-server
service mysqld start
It works like a charm. Not recommending this solution if the database have useful data inside.
answered Aug 26, 2019 at 2:51
- deleet the old mysql files
- delete the old mysql container/pod
- deploy the new mysql v 8
- solved the issue for me
answered Aug 15, 2022 at 15:07
Всем привет!
При загрузке Apache на локальном сервере Laragon получаю ошибку запуска бд mariadb.
Вот лог, помогите разобраться mysqld.log
[Note] InnoDB: 5.7.14 started; log sequence number 4762627838
[Note] InnoDB: Loading buffer pool(s) from C:Laragondataib_buffer_pool
[Note] Plugin ‘FEEDBACK’ is disabled.
[Note] Recovering after a crash using mysql-bin
[Note] Starting crash recovery…
[Note] Crash recovery finished.
[Note] Server socket created on IP: ‘::’.
[Note] C:Laragonbinmysqlmariadb-10.2.3-win32binmysqld: ready for connections. Version: ‘10.2.3-MariaDB-log’ socket: » port: 3306 mariadb.org binary distribution
[Note] InnoDB: Compressed tables use zlib 1.2.11
[Note] InnoDB: Number of transaction pools: 1
[Note] InnoDB: Using crc32 + pclmulqdq instructions
[Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.2.3.
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[Note] InnoDB: Starting shutdown…
[ERROR] Plugin ‘InnoDB’ init function returned error.
[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
[Note] Plugin ‘FEEDBACK’ is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
[Note] InnoDB: Compressed tables use zlib 1.2.11
[Note] InnoDB: Number of transaction pools: 1
[Note] InnoDB: Using crc32 + pclmulqdq instructions
[Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.2.3.
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[Note] InnoDB: Starting shutdown…
[ERROR] Plugin ‘InnoDB’ init function returned error.
[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
[Note] Plugin ‘FEEDBACK’ is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
Raise your hand if you’ve never had a problem with corrupt government officials… oops, MySQL databases.
Last week I was importing a new set of tax calculation rules to our tax engine but forgot to check if I had enough RAM and swap on my machine to do that. As a result, memory consumption hit the ceiling and the OOM killer killed the MySQL process.
When I restarted the machine and tried to connect to MySQL server I was greeted with this message:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
Trying to stop/start the MySQL process (a trick we all learned in the good old Windows) didn’t help.
Checking the MySQL error log in /var/log/mysql/error.log I could spot the following suspect lines:
[ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 97983975202 and the end 97984446291.
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Failed to initialize plugins.
[ERROR] Aborting
[Note] Binlog end
[Note] /usr/sbin/mysqld: Shutdown complete
OK, so it seems the redo log is corrupt. Well, if the redo log is corrupt, let’s remove it! I’m not worried about the data that was being imported. I can re-run the full import again later.
sudo rm /var/lib/mysql/ib_logfile0
sudo rm /var/lib/mysql/ib_logfile1
Trying to stop/start the MySQL process still didn’t work but after removing the redo log I had a different error in the log file (/var/log/mysql/error.log):
[ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
Checking the link informed in the error message it seemed the right thing to do was to go with the innodb_force_recovery parameter in the config file (my config file was located at /etc/mysql/mysql.conf.d/mysqld.cnf ). I started with 1, as suggested, but I was able to start the MySQL server only when got to innodb_force_recovery=4.
[mysqld]
innodb_force_recovery = 4
After starting the MySQL server and being able to read all the databases and tables (but not write, as innodb_force_recovery = 4 put them in read-only mode) I dumped all my data:
mysqldump -u root -p --all-databases > all_db_local.sql
Having all my data saved in a file, I completely removed my current MySQL installation (and all databases) and installed a new one:
sudo rm -rf /var/lib/mysql/
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server
sudo apt-get install libmysqlclient-dev
With a fresh MySQL install all I had to do was bring my data back in:
mysql -u root < ~/all_db_local.sql
It took some time but, in the end, I had my MySQL server back to operation.