Openshift Nightmare - lost all mysql innoDB data unexpectedly - php

My website is hosted over openshift, everything was working fine by then end of the day, I turned off my PC and slept, in the morning I saw I was not able to login to website or see any events.
Then I opened phpMyAdmin to see what is going on, when I clicked my database it says,
--No tables found.
Though, tables names were displayed under database name, I was not able to access either data or structure of the table, I was Screwed!!!
I opened the log files, but couldn't understand it.
Then I googled, how can I get my data back using ibdata1 and iblog flies, but the procedure was tricky. I had a feeling that I lost my data, that was also confirmed after digging a bit.
I want to know why this happened, so it shouldn't happen in future. I couldn't figure out the reason yet.
Here is my log file:-
151218 00:09:24 mysqld_safe Logging to '/var/lib/openshift/56182a0f0c1e6645c6000/mysql//stdout.err'.
151218 00:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/56182a0f0c1e6645c6000/mysql/data/
151218 00:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/56182a0f0c1e6645c6000/mysql/data/
151218 0:09:24 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld (mysqld 5.5.45) starting as process 439115 ...
151218 0:09:24 [Note] Plugin 'FEDERATED' is disabled.
151218 0:09:24 InnoDB: The InnoDB memory heap is disabled
151218 0:09:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151218 0:09:24 InnoDB: Compressed tables use zlib 1.2.3
151218 0:09:24 InnoDB: Using Linux native AIO
151218 0:09:24 InnoDB: Initializing buffer pool, size = 32.0M
151218 0:09:24 InnoDB: Completed initialization of buffer pool
151218 0:09:24 InnoDB: highest supported file format is Barracuda.
151218 0:09:24 InnoDB: Waiting for the background threads to start
151218 0:09:25 InnoDB: 5.5.45 started; log sequence number 1595675
151218 0:09:25 [Note] Server hostname (bind-address): '127.4.242.2'; port: 3306
151218 0:09:25 [Note] - '127.4.242.2' resolves to '127.4.242.2';
151218 0:09:25 [Note] Server socket created on IP: '127.4.242.2'.
151218 0:09:25 [Warning] 'proxies_priv' entry '# root#ex-std-node687.prod.rhcloud.com' ignored in --skip-name-resolve mode.
151218 0:09:25 [Note] Event Scheduler: Loaded 0 events
151218 0:09:25 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connections.
Version: '5.5.45' socket: '/var/lib/openshift/56182a0f0c1e6645c6000/mysql//socket/mysql.sock' port: 3306 MySQL Community Server (GPL)
151218 0:09:53 [ERROR] Cannot find or open table ecell/e_users from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html
how you can resolve the problem.
151218 0:09:53 [ERROR] Cannot find or open table ecell/events from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html
how you can resolve the problem.
151218 0:09:53 [ERROR] Cannot find or open table ecell/pastevents from
the internal data dictionary of InnoDB the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.

Related

Xampp mysql Error: MySQL shutdown unexpectedly

when I starting mysql, giving the following error:
17:43:13 [mysql] Error: MySQL shutdown unexpectedly.
17:43:13 [mysql] This may be due to a blocked port, missing dependencies,
17:43:13 [mysql] improper privileges, a crash, or a shutdown by another method.
17:43:13 [mysql] Press the Logs button to view error logs and check
17:43:13 [mysql] the Windows Event Viewer for more clues
17:43:13 [mysql] If you need more help, copy and post this
17:43:13 [mysql] entire log window on the forums
then, I check the mysql_error.log:
2017-05-03 17:39:39 202c 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.
170503 17:39:39 [Note] InnoDB: Using mutexes to ref count buffer pool pages
170503 17:39:39 [Note] InnoDB: The InnoDB memory heap is disabled
170503 17:39:39 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
170503 17:39:39 [Note] InnoDB: Memory barrier is not used
170503 17:39:39 [Note] InnoDB: Compressed tables use zlib 1.2.3
170503 17:39:39 [Note] InnoDB: Not using CPU crc32 instructions
170503 17:39:39 [Note] InnoDB: Initializing buffer pool, size = 16.0M
170503 17:39:39 [Note] InnoDB: Completed initialization of buffer pool
170503 17:39:39 [Note] InnoDB: Highest supported file format is Barracuda.
170503 17:39:39 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1600674 in the ib_logfiles!
170503 17:39:39 [Note] InnoDB: Database was not shutdown normally!
170503 17:39:39 [Note] InnoDB: Starting crash recovery.
170503 17:39:39 [Note] InnoDB: Reading tablespace information from the .ibd files...
170503 17:39:39 [Note] InnoDB: Restoring possible half-written data pages
170503 17:39:39 [Note] InnoDB: from the doublewrite buffer...
170503 17:39:39 [Note] InnoDB: 128 rollback segment(s) are active.
170503 17:39:39 [Note] InnoDB: Waiting for purge to start
170503 17:39:40 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-72.0 started; log sequence number 1600674
170503 17:39:40 [Note] Plugin 'FEEDBACK' is disabled.
170503 17:39:40 [Note] Server socket created on IP: '::'.
finally, I moved xampp/mysql/backup files into xampp/mysql/data and run mysql again.Then, it worked!But I don't know why.What led to this problem.
Hope someone doubts for me!
I searched on google and tried everything like port changing, delete files, reinstall xampp, copy and paste backup files to mysql/data folder but nothing worked.
I found the best solution to this problem.
Solution:
go to xampp/mysql/data and take a backup of this folder
delete all selected files in the below image
Copy selected files in below image from xampp/mysql/backup and paste it to xampp/mysql/data folder
Now restart your xampp server and it will run like before. no need to delete your database or reinstall your xampp server
If you're not running XAMPP as an administrator, shutting down MySQL can cause corruption which means you have to repair or delete your tables. This can easily be avoided by running XAMPP as administrator.
Open Services on XAMPP Control Panel
Look for the service MySQL80, right click on this service and click Stop
Get back to XAMPP Control Panel and start MySQL
this worked for me.
Open Services on XAMPP Control Panel
Look for the Services > MySQL80,
right click on this Services and click Stop
Get back to XAMPP Control Panel and start MySQL
thanks to #Shahjahan

XAMPP on Windows MYSQL Will start and then stop abruptly but APACHE works fine

Alright, I looked everywhere for a solution and none of them worked. Yesterday, My XAMPP worked perfectly fine. Today, I tried to start my MySQL service and it doesn't work. Let me be more specific: This is the XAMPP log:
Attempting to start MySQL app...
9:54:00 AM [mysql] Status change detected: running
9:54:01 AM [mysql] Status change detected: stopped
9:54:01 AM [mysql] Error: MySQL shutdown unexpectedly.
9:54:01 AM [mysql] This may be due to a blocked port, missing dependencies,
9:54:01 AM [mysql] improper privileges, a crash, or a shutdown by another >method.
9:54:01 AM [mysql] Press the Logs button to view error logs and check
9:54:01 AM [mysql] the Windows Event Viewer for more clues
9:54:01 AM [mysql] If you need more help, copy and post this
9:54:01 AM [mysql] entire log window on the forum
This is the error log:
016-03-23 09:54:00 1d04 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.
160323 9:54:00 [Note] InnoDB: Using mutexes to ref count buffer pool pages
160323 9:54:00 [Note] InnoDB: The InnoDB memory heap is disabled
160323 9:54:00 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
160323 9:54:00 [Note] InnoDB: Memory barrier is not used
160323 9:54:00 [Note] InnoDB: Compressed tables use zlib 1.2.3
160323 9:54:00 [Note] InnoDB: Not using CPU crc32 instructions
160323 9:54:00 [Note] InnoDB: Initializing buffer pool, size = 16.0M
160323 9:54:00 [Note] InnoDB: Completed initialization of buffer pool
160323 9:54:00 [Note] InnoDB: Highest supported file format is Barracuda.
160323 9:54:00 [Note] InnoDB: The log sequence numbers 1665234 and 1665234 in ibdata files do not match the log sequence number 2110930 in the ib_logfiles!
160323 9:54:00 [Note] InnoDB: Database was not shutdown normally!
160323 9:54:00 [Note] InnoDB: Starting crash recovery.
160323 9:54:00 [Note] InnoDB: Reading tablespace information from the .ibd files...
160323 9:54:00 [Note] InnoDB: Restoring possible half-written data pages
160323 9:54:00 [Note] InnoDB: from the doublewrite buffer...
160323 9:54:01 [Note] InnoDB: 128 rollback segment(s) are active.
160323 9:54:01 [Note] InnoDB: Waiting for purge to start
160323 9:54:01 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-72.0 started; log sequence number 2110930
160323 9:54:01 [Note] Plugin 'FEEDBACK' is disabled.
160323 9:54:01 [Note] Server socket created on IP: '::'.
Apache works and is running btw. The things that I tried:
Deleting the ibdata1 file.
Changing the port in my.ini.
Skype is not running.
Stopping World wide Web Publishing Service.
Ok, I figured it out myself. So I looked into the windows event viewer and saw that some errors were coming from MySQL. I clicked on the most recent one and found this.
mysqld.exe: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
I replaced all db files: db.frm, db. MYD, and db.MYI (Copy these to desktop just in case) with the ones from backup. And viola it works again. All the data is there, even the ones I remember inserting in yesterday.
In my case it is because I have MySQL Workbench installed, which also uses port 3306 for its own installation of MySQL.
So there are 2 installations of MySQL, and both trying to use port 3306. Workbench seemed to take precedence.
It was easiest to change XAMPP MySQL to use port 3308.
From XAMPP Control Panel: Stop Apache and MySql.
Edit my.ini (in some MySql installations this will be my.cnf; in others my.ini)
It's location will depend on where you have installed XAMPP. On my system I found it at T:\xampp\mysql\bin\my.ini.
(The comparable file for my MySQL Workbench on my system is located at ``)
Search for 3306 (or port); Replace with 3308.
There were 2 places where I replaced the line: port = 3306 with: port = 3308
Save
From XAMPP Control Panel: Start Apache and MySql

MySQL not starting in MAMP PRO

Right, so i've been playing with MAMP and use it to mess around with wordpress plugins and themes. However, I've been forced to keep MAMP running at all times because the moment I restart the server (after the first install of MAMP), mySql doesnt start. It works immediately after reinstalling MAMP, but anytime I stop it, it simply gives me an error. The exact error log is:
150812 10:31:33 mysqld_safe Starting mysqld daemon with databases
from /Library/Application Support/appsolute/MAMP PRO/db/mysql 150812
10:31:33 [Warning] Setting lower_case_table_names=2 because file
system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/
is case insensitive 150812 10:31:33 [Note] Plugin 'FEDERATED' is
disabled. /Applications/MAMP/Library/bin/mysqld: Table 'mysql.plugin'
doesn't exist 150812 10:31:33 [ERROR] Can't open the mysql.plugin
table. Please run mysql_upgrade to create it. 150812 10:31:33 InnoDB:
The InnoDB memory heap is disabled 150812 10:31:33 InnoDB: Mutexes
and rw_locks use GCC atomic builtins 150812 10:31:33 InnoDB:
Compressed tables use zlib 1.2.3 150812 10:31:33 InnoDB: Initializing
buffer pool, size = 128.0M 150812 10:31:33 InnoDB: Completed
initialization of buffer pool 150812 10:31:33 InnoDB: highest
supported file format is Barracuda. 150812 10:31:33 InnoDB: Waiting
for the background threads to start 150812 10:31:34 InnoDB: 5.5.42
started; log sequence number 346953327 150812 10:31:34 [ERROR] Fatal
error: Can't open and lock privilege tables: Table 'mysql.host'
doesn't exist 150812 10:31:34 mysqld_safe mysqld from pid file
/Applications/MAMP/tmp/mysql/mysql.pid ended
I've literally tried everything from killing all mysql processes, to changing port numbers, to restarting both MAMP and the Computer... Nothing seems to work. I even changed the file permission of host.frm to allow all users read&write access.
I have spent hours and hours looking to no avail :( Any suggestions would be HUGELY appreciated!
Thank you!
Shayne

Xampp mysql innodb recovery failed after pc crash

So it's happened to me a few times that i have this issue. I didn't realised why it's happening i just know after restarting pc mysql won't start.
So i was reinstalling xampp and messing around few times untill i got it work. Last time when it happened i looked at mysql.err file and noticed errors are about corrupted files. So i deleted those databases and mysql started
But today i have seen the right reason. I was sitting by pc when it suddenly got frozen and restarted. After that mysql won't start.
Looking at my localhost/xampp status page it says mysql deactivated
Went to check logs, actually mysql.err file and there it says recovery from crash and innodb can't recover from crash.
Here are the logs
2014-03-05 11:18:11 7829 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
2014-03-05 11:18:11 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-03-05 11:18:11 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-03-05 11:18:11 8235 [Note] Plugin 'FEDERATED' is disabled.
2014-03-05 11:18:11 8235 [Note] InnoDB: The InnoDB memory heap is disabled
2014-03-05 11:18:11 8235 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-03-05 11:18:11 8235 [Note] InnoDB: Compressed tables use zlib 1.2.8
2014-03-05 11:18:11 8235 [Note] InnoDB: Not using CPU crc32 instructions
2014-03-05 11:18:11 8235 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2014-03-05 11:18:11 8235 [Note] InnoDB: Completed initialization of buffer pool
2014-03-05 11:18:11 8235 [Note] InnoDB: Highest supported file format is Barracuda.
2014-03-05 11:18:11 8235 [Note] InnoDB: The log sequence numbers 11011943 and 11011943 in ibdata files do not match the log sequence number 11012198 in the ib_logfiles!
2014-03-05 11:18:11 8235 [Note] InnoDB: Database was not shutdown normally!
2014-03-05 11:18:11 8235 [Note] InnoDB: Starting crash recovery.
2014-03-05 11:18:11 8235 [Note] InnoDB: Reading tablespace information from the .ibd files...
2014-03-05 11:18:11 8235 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace wpdemo/wp_terms uses space ID: 93 at filepath: ./wpdemo/wp_terms.ibd. Cannot open tablespace wordpress/wp_evg_feeds which uses space ID: 93 at filepath: ./wordpress/wp_evg_feeds.ibd
2014-03-05 11:18:11 7f3ca4a11700 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./wordpress/wp_evg_feeds.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.
2014-03-05 11:18:11 7829 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/aleksandar-PC.pid ended
Last time when i got an error i didn't realised it was because of pc crash and i didn't needed files, so i just deleted corrupted database files and mysql started. Problem is now I CAN'T delete any file, i need those databases back and working.
Any suggestions?
So renaming broken files to for example wp_terms.ibd.bkp so mysql can skip those tables and start. Now when mysql recovered and started, i shut it down regularly. Than renamed .bkp files back to normal table files and started mysql back. Now when mysql is shut down regularly it won't check for recovery and started normally. The files that are supposed to be broken are working now. And everything is back to normal. What a logic!

XAMPP/MySQL: could not open single-table tablespace file .\mysql\innodb_index_stats.ibd after restart of MySQL

I've installed Drupal on my local XAMPP Server. It worked all fine, no problems with including and working with the database/site till i restarted XAMPP. Since then I get the following at my logfile:
2013-09-02 16:18:46 2544 [Note] Plugin 'FEDERATED' is disabled.
2013-09-02 16:18:46 3e8 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.
2013-09-02 16:18:46 2544 [Note] InnoDB: The InnoDB memory heap is disabled
2013-09-02 16:18:46 2544 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2013-09-02 16:18:46 2544 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-09-02 16:18:46 2544 [Note] InnoDB: Not using CPU crc32 instructions
2013-09-02 16:18:46 2544 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2013-09-02 16:18:46 2544 [Note] InnoDB: Completed initialization of buffer pool
2013-09-02 16:18:46 2544 [Note] InnoDB: Highest supported file format is Barracuda.
2013-09-02 16:18:47 2544 [Note] InnoDB: The log sequence numbers 1600614 and 1600614 in ibdata files do not match the log sequence number 1600644 in the ib_logfiles!
2013-09-02 16:18:47 2544 [Note] InnoDB: Database was not shutdown normally!
2013-09-02 16:18:47 2544 [Note] InnoDB: Starting crash recovery.
2013-09-02 16:18:47 2544 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-09-02 16:18:47 2544 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace drupal/variable uses space ID: 2 at filepath: .\drupal\variable.ibd. Cannot open tablespace mysql/innodb_index_stats which uses space ID: 2 at filepath: .\mysql\innodb_index_stats.ibd
InnoDB: Error: could not open single-table tablespace file .\mysql\innodb_index_stats.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.
I looked for a solution via google but it seems to be a problem just with the drupal database because it's able to connect with MySQL if I remove the database.
I hope someone could help me :(.
Move (DON'T DELETE) those files, into another folder:
innodb_index_stats.frm
innodb_table_stats.frm
slave_master_info.frm
slave_relay_log_info.frm
slave_worker_info.frm
and .ibd files with the same filename:
innodb_index_stats.ibd
innodb_table_stats.ibd
slave_master_info.ibd
slave_relay_log_info.ibd
slave_worker_info.ibd
Try start MySQL.
You can solve this problem by adding a line in your mysql config file: my.cnf or my.ini (depends on your distro)
just under [mysqld] add this line: innodb_force_recovery = 1
..
[mysqld]
innodb_force_recovery = 1
..
Then restart your MySql Server.
You could have lost some data but you'll get the server working again with your data.
Regards,
dev_khan,
try restarting MySQL in Read-Only mode with the innodb_force_recovery option enabled:
Edit my.cnf - find the line: # innodb_force_recovery = 2
Comment the line in (remove the #)
Restart MySQL to let the MySQL engine repair itself.
Comment the innodb_force_recovery line in again (add #)
Restart MySQL again and you have full access again without a Read-Only-Restriction.
Greetings from Germany
This happens with Wordpress too. It only seems to happen with the latest version as I've rolled back to previous versions of AMPPS and it works fine without throwing up this innodb issue.

Categories