When I uncomment innodb in my.cf it breaks - mysql

I'm wondering why when I uncomment the following lines in the /etc/my.cf it breaks mysql and I'm unable to restart it. I'm not all that great with mysql but I've been googling for hours trying to figure it out. Innodb is running on my server and all my db are running innodb. If I can provide you guys with more info please let me know how.
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
Edit: This is what the mysql error log says
140129 8:53:21 [Note] Plugin 'FEDERATED' is disabled.
140129 8:53:21 InnoDB: The InnoDB memory heap is disabled
140129 8:53:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140129 8:53:21 InnoDB: Compressed tables use zlib 1.2.3
140129 8:53:21 InnoDB: Using Linux native AIO
140129 8:53:21 InnoDB: Initializing buffer pool, size = 384.0M
140129 8:53:21 InnoDB: Completed initialization of buffer pool
InnoDB: Error: data file /var/lib/mysql/ibdata1 is of a different size
InnoDB: 19072 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 128000 pages!
140129 8:53:21 InnoDB: Could not open or create data files.
140129 8:53:21 InnoDB: If you tried to add new data files, and it failed here,
140129 8:53:21 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140129 8:53:21 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140129 8:53:21 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140129 8:53:21 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140129 8:53:21 InnoDB: remove old data files which contain your precious data!
140129 8:53:21 [ERROR] Plugin 'InnoDB' init function returned error.
140129 8:53:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140129 8:53:21 [ERROR] Unknown/unsupported storage engine: InnoDB
140129 8:53:21 [ERROR] Aborting

To save this, just add the following to the /etc/mysql/my.cnf file (reference):
skip-innodb

Before do anything backup your data !
Remove files starting with ib_logfile , should be ib_logfile0 and ib_logfile1 in /var/lib/mysql.
Then re/start the server

Related

Mysql failed to start due to errors from innodb

I am trying to run MySql on my Virtual Machine. However, I encountered the following error and thus MySql cannot start up. I am new to MySql. Your help is really appreciated! Here is the message from the error log:
[Note] Plugin 'FEDERATED' is disabled.
/opt/mysql/mysql/sbin/mysqld: Table 'mysql.plugin' doesn't exist
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[Note] InnoDB: Using atomics to ref count buffer pool pages
[Note] InnoDB: The InnoDB memory heap is disabled
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: Memory barrier is not used
[Note] InnoDB: Compressed tables use zlib 1.2.3
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, size = 128.0M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: Restoring page 0 of tablespace 0
[Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
[ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
/opt/mysql/mysql/sbin/mysqld: Table 'mysql.plugin' doesn't exist
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
IF you read in carefully, first line enlightens the problem and the second line advises solution for it.
run mysql_upgrade to fix it.
Seems, you didn't set path of your ibdata1 or you removed ibdata1 file. Please check my.cnf and set below parameter in my.cnf.
innodb_data_home_dir (path of innodb)
innodb_data_file_path (for example: ibdata1:10M:autoextend)
Note: If it's new setup then also enable innodb_file_per_table

MySql service won't start from recovered ibdata1 file

One of our servers was the subject of a ransomware attack from a group of international Hackers. So we’ve re-grouped and started over and the only unaffected data we had was the ibdata1 file stored in mysql program data folder.
We would like to restore that data on the new instance so that we carry forward our operations but after trying to run the new installation of mysql it the service stops with error 1067. It suggests to delete all files created by InnoDB: all ibdata files and all ib_logfile files. If I do that the service will run but I can’t do it because I need to access the data in this particular data file. I’ve also added these two lines in my .cnf file
innodb_force_recovery=6
innodb_fast_shutdown=0
That hasn’t worked. So I deleted just the log files and it created new log files along with it came this error
190223 11:38:48 [Note] Plugin 'FEDERATED' is disabled.
190223 11:38:48 InnoDB: The InnoDB memory heap is disabled
190223 11:38:48 InnoDB: Mutexes and rw_locks use Windows interlocked functions
190223 11:38:48 InnoDB: Compressed tables use zlib 1.2.3
190223 11:38:48 InnoDB: Initializing buffer pool, size = 2.0G
190223 11:38:48 InnoDB: Completed initialization of buffer pool
190223 11:38:48 InnoDB: highest supported file format is Barracuda.
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/error-creating-innodb.html
190223 11:38:48 [ERROR] Plugin 'InnoDB' init function returned error.
190223 11:38:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190223 11:38:48 [ERROR] Unknown/unsupported storage engine: INNODB
190223 11:38:48 [ERROR] Aborting
Then I replaced the log files with the same ones I used with the original ibdata1 file then I got this error.
190223 12:11:26 [Note] Plugin 'FEDERATED' is disabled.
190223 12:11:26 InnoDB: The InnoDB memory heap is disabled
190223 12:11:26 InnoDB: Mutexes and rw_locks use Windows interlocked functions
190223 12:11:26 InnoDB: Compressed tables use zlib 1.2.3
190223 12:11:26 InnoDB: Initializing buffer pool, size = 2.0G
190223 12:11:26 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file .\ib_logfile0 is of different size 0 1073741824 bytes
InnoDB: than specified in the .cnf file 0 224395264 bytes!
190223 12:11:26 [ERROR] Plugin 'InnoDB' init function returned error.
190223 12:11:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190223 12:11:26 [ERROR] Unknown/unsupported storage engine: INNODB
190223 12:11:26 [ERROR] Aborting
It appears there is a check point somewhere in the log files that is necessary for the data file to be read properly by the mysql service. Maybe I need to specify the log file size in the my.ini config file. But I don’t know how to go about it.
Any help will really come in handy here.
In your my.ini (or my.cnf) file, add (or replace) the following line:
innodb_log_file_size = 1024M
See https://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_log_file_size for details.

MySQL (MariaDB) will not restart after my.cnf change

I changed my.cnf to add the innodb_log_file_size setting and when attempting to the start the server it fails with the following in the error log:
[Note] InnoDB: Using mutexes to ref count buffer pool pages
[Note] InnoDB: The InnoDB memory heap is disabled
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
[Note] InnoDB: Compressed tables use zlib 1.2.7
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Using SSE crc32 instructions
[Note] InnoDB: Initializing buffer pool, size = 128.0M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: Highest supported file format is Barracuda.
[Note] InnoDB: The log sequence number 10942739155 in ibdata file do not match the log sequence number 11517047974 in the ib_logfiles!
[Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
[ERROR] InnoDB: The page [page id: space=0, page number=7] in file ./ibdata1 cannot be decrypted.
[Note] InnoDB: However key management plugin or used key_version 1 is not found or used encryption algorithm or method does not match.
[ERROR] InnoDB: Ending processing because of a corrupt database page.
InnoDB: Assertion failure in thread 139948494317824 in file ha_innodb.cc line 21960
Below is what is in my.cnf:
[mysqld]
log-error=/var/lib/mysql/error-log.err
performance-schema=0
default-storage-engine=innodb
innodb_file_per_table=1
query-cache-type = 1
query-cache-size = 256M
local-infile=0
bind-address=127.0.0.1
innodb_log_file_size = 256M
plugin-load-add=file_key_management
file_key_management_filename=/path-to-key/secret.txt
file_key_management_encryption_algorithm=AES_CTR
innodb-encrypt-tables
innodb-encrypt-log
innodb-encryption-threads = 4
innodb-encrypt-tables=FORCE
innodb-tablespaces-encryption
max_allowed_packet=268435456
open_files_limit=10000
innodb_fast_shutdown is set to 1. Also, I deleted (renamed) both ib_logfile0 and ib_logfile1 before restarting. The database uses encryption at rest. Any ideas?
MariaDB version: 10.1.26

Recover DB from ibdata1, ib_logfile0, ib_logfile1 and .frm files

Recently My production server was corrupted due to maintenance shutdown by digital ocean. When we trying to recover our database we couldn't access our droplet. Somehow we managed to recover these (ibdata1, ib_logfile0, ib_logfile1 and some .frm) files. When i copied this files to my new mysql server(in another machine), I could't start the mysql server. I got this output
sudo service mysql restart
mysql stop/waiting
start: Job failed to start
I checked the log file and i got this error,
151019 8:55:27 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:27 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:27 InnoDB: The InnoDB memory heap is disabled
151019 8:55:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:27 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:27 InnoDB: Using Linux native AIO
151019 8:55:27 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:27 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:27 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:27 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:27 [ERROR] Aborting
151019 8:55:27 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:28 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:28 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:28 InnoDB: The InnoDB memory heap is disabled
151019 8:55:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:28 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:28 InnoDB: Using Linux native AIO
151019 8:55:28 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:28 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:28 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:28 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:28 [ERROR] Aborting
151019 8:55:28 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:29 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:29 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:29 InnoDB: The InnoDB memory heap is disabled
151019 8:55:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:29 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:29 InnoDB: Using Linux native AIO
151019 8:55:29 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:29 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:29 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:29 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:29 [ERROR] Aborting
151019 8:55:29 [Note] /usr/sbin/mysqld: Shutdown complete
I tried adding innodb_log_file_size= 50331648 as suggested by #akuzminsky
Then I got this error log.
151022 6:54:13 [Warning] Using unique option prefix myisam-recover instead of $
151022 6:54:13 [Note] Plugin 'FEDERATED' is disabled.
151022 6:54:13 InnoDB: The InnoDB memory heap is disabled
151022 6:54:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151022 6:54:13 InnoDB: Compressed tables use zlib 1.2.8
151022 6:54:13 InnoDB: Using Linux native AIO
151022 6:54:13 InnoDB: Initializing buffer pool, size = 128.0M
151022 6:54:13 InnoDB: Completed initialization of buffer pool
151022 6:54:13 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 15379293
151022 6:54:13 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: space header page consists of zero bytes in file ./toucan/ormcli$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/catego$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/survey$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/compla$
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 15382291
InnoDB: Page directory corruption: infimum not pointed to
151022 6:54:13 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex 10cfd0d80000000000000000000000000000000000e9e915000800000000001$
InnoDB: End of page dump
151022 6:54:13 InnoDB: Page checksum 282054872, prior-to-4.0.14-form checksum$
InnoDB: stored checksum 282054872, prior-to-4.0.14-form stored checksum 3468306$
InnoDB: Page lsn 0 15329557, low 4 bytes of lsn at page end 15329557
InnoDB: Page number (if stored to page already) 0,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a file space header page
10:54:13 UTC - mysqld got signal 11 ;
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.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=16777216
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 = 346701 K $
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
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 = 0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x20)[0x7fa4d90e2f10]
/usr/sbin/mysqld(handle_fatal_signal+0x3d5)[0x7fa4d8fcd175]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7fa4d7d5d340]
/usr/sbin/mysqld(+0x5f058a)[0x7fa4d91e258a]
/usr/sbin/mysqld(+0x56c44e)[0x7fa4d915e44e]
/usr/sbin/mysqld(+0x576137)[0x7fa4d9168137]
/usr/sbin/mysqld(+0x5a5632)[0x7fa4d9197632]
/usr/sbin/mysqld(+0x5a6699)[0x7fa4d9198699]
/usr/sbin/mysqld(+0x591ad3)[0x7fa4d9183ad3]
/usr/sbin/mysqld(+0x542a1a)[0x7fa4d9134a1a]
/usr/sbin/mysqld(+0x511d48)[0x7fa4d9103d48]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x41)[0x7fa4d8fcf$
/usr/sbin/mysqld(+0x302221)[0x7fa4d8ef4221]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x92a)[0x7fa4d8ef821a]
/usr/sbin/mysqld(+0x28ac5b)[0x7fa4d8e7cc5b]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x45b)[0x7fa4d8e815db]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fa4d739fec5]
/usr/sbin/mysqld(+0x286b18)[0x7fa4d8e78b18]
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.
Please help me to resolve this.
Thanks in advance.
Note lines in the error log:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
The actual size of the redo log file differs from the size in MySQL config.
Add this line to my.cnf
innodb_log_file_size= 50331648
If the tablespace is corrupted you'll still have to heal it. But at least MySQL won't stop at this step.

Mysql doesn't run

I have no idea if this question fit to SO, but if it doesn't just close it...
The problem is that after migrating to another dedicated server, I can not get my MySQL server started, the loggs are saying the following:
120625 13:04:10 mysqld_safe mysqld from pid file /var/db/mysql/ropp.pid ended
120625 13:04:29 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
120625 13:04:29 InnoDB: The InnoDB memory heap is disabled
120625 13:04:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120625 13:04:29 InnoDB: Compressed tables use zlib 1.2.3
120625 13:04:29 InnoDB: Initializing buffer pool, size = 128.0M
120625 13:04:29 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 104857600 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
120625 13:04:29 [ERROR] Plugin 'InnoDB' init function returned error.
120625 13:04:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120625 13:04:29 [ERROR] Unknown/unsupported storage engine: InnoDB
120625 13:04:29 [ERROR] Aborting
120625 13:04:29 [Note] /usr/local/libexec/mysqld: Shutdown complete
120625 13:04:29 mysqld_safe mysqld from pid file /var/db/mysql/ropp.pid ended
Where is the problem and what do I have to do?
My MySQL server version is 5.5.
The problem is that mysql configuration on your new server does not match the older one. The variable innodb_log_file_size is set to 5M but actual size of log is 100MB. You need to change that value in my.cnf.
Shutdown MySQL server if it is running (it should not be). Edit my.cnf and change the value of innodb_log_file_size to 100M
innodb_log_file_size = 100M
This should fix the problem. Start the server. If it doesn't work, then stop the server, move the ib_logfile0 and ib_logfile1 to .bak and start the server again.