Mysql failed to start due to errors from innodb - mysql

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

Related

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 has broke, can not be started: "Restoring possible half-written data pages from the doublewrite buffer..."

When attempting to start the mysql server, it returns with exit code 1. I've done this a million times before on this server. Without messing with the server in the past month, mysql has suddenly stopped and I can not start it. My 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.8
[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: Starting crash recovery from checkpoint LSN=591771482442
Everything goes to ruin below this line.
[Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
InnoDB: Set innodb_force_recovery to ignore this error.
[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
Until I can start mysql-server, I can not run mysqldump nor mysql -u root:
Got error: 2002: "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")" when trying to connect
I'm running mariadb-server 10.1.23-9-deb9u1.
Not sure if this will work but since the server doesn't work anyway so try this out:
Rename logfile0 and logfile1 and then restart the server.
Before doing anything, make a copy of the entire mysql folder to another location just in case.
The answer was right infront of me:
InnoDB: Set innodb_force_recovery to ignore this error.
I set innodb_force_recovery = 1 after the [mysqld] clause in my /etc/mysql/mariadb.conf.d/50-server.cnf (This file may very depending on your OS).
I restarted it and it repaired itself. I later took out the innodb_force_recovery = 1 and restarted again, it then worked just fine.
What did I learn? Have more faith in "auto-repair" procedures. My expectations were so low for them because of my exposure to Microsoft Windows.

XAMPP: MySQL not starting

I was in the middle of developing my site and both apache and mysql were running normally until suddenly, the database failed to connect. I checked my XAMPP control panel and MySQL had stopped running. I searched for a solution here and some other similar questions on SO but i haven't been able to find a solution that works for me. Here is the contents of mysql_error.log file:
2016-04-15 20:30:18 150c InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
160415 20:30:18 [Note] InnoDB: Using mutexes to ref count buffer pool pages
160415 20:30:18 [Note] InnoDB: The InnoDB memory heap is disabled
160415 20:30:18 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
160415 20:30:18 [Note] InnoDB: Memory barrier is not used
160415 20:30:18 [Note] InnoDB: Compressed tables use zlib 1.2.3
160415 20:30:18 [Note] InnoDB: Not using CPU crc32 instructions
160415 20:30:18 [Note] InnoDB: Initializing buffer pool, size = 16.0M
160415 20:30:18 [Note] InnoDB: Completed initialization of buffer pool
160415 20:30:18 [Note] InnoDB: Restoring page 0 of tablespace 0
160415 20:30:18 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
160415 20:30:18 [ERROR] InnoDB: space header page consists of zero bytes in data file D:\xampp\mysql\data\ibdata1
160415 20:30:18 [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!
160415 20:30:18 [ERROR] Plugin 'InnoDB' init function returned error.
160415 20:30:18 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160415 20:30:18 [Note] Plugin 'FEEDBACK' is disabled.
160415 20:30:18 [ERROR] Unknown/unsupported storage engine: InnoDB
160415 20:30:18 [ERROR] Aborting
160415 20:30:18 [Note] D:\xampp\mysql\bin\mysqld.exe: Shutdown complete
What i have tried until now:
i have changed to port address for from 3306 to 3307, 3310. Didn't work.
i deleted ibdata1 file. Although the file reappeared back in its place after i attempted to restart MySQL. (I learnt later that i would lose my tables if ibdata1 is missing. i don't want that.)
Why did MySQL suddenly run into problems and and how to start MySQL without losing my tables?
There are several reason MySql keeps shutting down unexpectedly.
I am assuming that you have not installed multiple mysql server versions in the same machine.
Stop Mysql service from xampp control panel or stop it manually from services.msc and quit the xampp control panel.
Delete these two log files (ib_logfile0 and ib_logfile1) from xampp/mysql/ directory. (Note: I am not sure about the exact path of log files, check in all the folders of xampp/mysql/ directory)
Restart Mysql service manually from services.msc
open xampp control panel, you should see mysql is running.
I also see your innodb_buffer_pool_size is very low.
Increase the buffer_pool_size to about 50-60% of your RAM. For example, If you have 2GB ram, then set buffer_pool_size= 1GB
run this query in mysql.
set innodb_buffer_pool_size=1073741824;
or
set global innodb_buffer_pool_size=1073741824;
restart mysql server.

MySQL wont start - Database crashed and now I get Error 1067

We have a MySQL database and last night there was a power outage which caused the machine it runs under to crash.
Now with the machine restarted, I am trying to run the MySQL service and I get the error:
"Error 1067: The process terminated unexpectedly"
Extract from the log:
2015-12-14 08:56:17 1248 [Note] Plugin 'FEDERATED' is disabled.
2015-12-14 08:56:17 1248 [Warning] option 'innodb-autoextend-increment': unsigned value 67108864 adjusted to 1000
2015-12-14 08:56:17 d64 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-12-14 08:56:17 1248 [Note] InnoDB: The InnoDB memory heap is disabled
2015-12-14 08:56:17 1248 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-12-14 08:56:17 1248 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-12-14 08:56:17 1248 [Note] InnoDB: Not using CPU crc32 instructions
2015-12-14 08:56:17 1248 [Note] InnoDB: Initializing buffer pool, size = 38.0M
2015-12-14 08:56:17 1248 [Note] InnoDB: Completed initialization of buffer pool
2015-12-14 08:56:17 1248 [Note] InnoDB: Highest supported file format is Barracuda.
2015-12-14 08:56:17 1248 [Note] InnoDB: The log sequence numbers 33664440039 and 33664440039 in ibdata files do not match the log sequence number 35948349561 in the ib_logfiles!
2015-12-14 08:56:17 1248 [Note] InnoDB: Database was not shutdown normally!
2015-12-14 08:56:17 1248 [Note] InnoDB: Starting crash recovery.
2015-12-14 08:56:17 1248 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-12-14 08:56:24 1248 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/innodb_table_stats uses space ID: 1 at filepath: .\mysql\innodb_table_stats.ibd. Cannot open tablespace teamcity/action_history which uses space ID: 1 at filepath: .\teamcity\action_history.ibd
InnoDB: Error: could not open single-table tablespace file .\teamcity\action_history.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
Anyone have a solution to this?
The solution, as the message indicates, is likely to be performing innodb_force_recovery > 0.
To do this, just edit my.cnf, search the file for innodb_force_recovery, it'll look like this:
#innodb_force_recovery = 0
Edit it thusly:
innodb_force_recovery = 2
Then restart the MySQL service. After stopping and restarting it, go back and replace the # in the my.cnf file, then restart the service again. Hopefully, you are able to access your tables. If not, try repeating the process, only set the value to 3 instead. Do not go higher than 3 without further researching innodb_force_recovery.
Best of luck, hope this helps.

Mysql stops working in my ubuntu machine 13.04

I am facing this weird issue. Suddenly mysql stops working and i am getting error log in /var/log/mysql/error.log
**
140501 17:21:09 [Note] Plugin 'FEDERATED' is disabled.
140501 17:21:09 InnoDB: The InnoDB memory heap is disabled
140501 17:21:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140501 17:21:09 InnoDB: Compressed tables use zlib 1.2.3.4
140501 17:21:10 InnoDB: Initializing buffer pool, size = 128.0M
140501 17:21:10 InnoDB: Completed initialization of buffer pool
140501 17:21:10 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
140501 17:21:10 [ERROR] Plugin 'InnoDB' init function returned error.
140501 17:21:10 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140501 17:21:10 [ERROR] Unknown/unsupported storage engine: InnoDB
140501 17:21:10 [ERROR] Aborting
140501 17:21:10 [Note] /usr/sbin/mysqld: Shutdown complete
**
Its very itching problem as I can write a single code without myqsl connection. How to solve this issue.
PS: Sorry Ubuntu fellas as I am using 13.04 unsupported version, I have already installed 14.04 and will move to it in a couple of days.
After going through lots of suggestions I found in stackoverflow and other mysql related websites, I did not success to fix this issue. then I reconfigure my mysql installations and voila its working now.
Command I used is
sudo dpkg-reconfigure mysql-server-5.5