473,408 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Need help with MYSQL table crash

Hello Experts,

I had a issue with a MYSQL Table. Here's my scenario.
CentOS Linux 6.4
MySQL version 5.1.69

When trying to run a script to update some tables the Mysql shows a warning at the EventData table

• I first check the table

[root@myserver]# myisamchk EventData.MYI --check
Checking MyISAM file: EventData.MYI
Data records: 46215316 Deleted blocks: 0
myisamchk: warning: 3 clients are using or haven't closed the table properly
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check record links
myisamchk: error: Found wrong record at 7619297220
MyISAM-table 'EventData.MYI' is corrupted
Fix it using switch "-r" or "-o"

Then I try to use the -r option however it did not repair
myisamchk -r /var/lib/mysql/gts/EventData.MYI

I did try to run the same code around 2 - 3 times but it did not work. I lookup on the web and found this code below however it do not work and stop with the message Segmentation fault (core dumped) as you can see below.

[root@myserver]# myisamchk --silent --force --fast --update-state /var/lib/mysql/gts/*.MYI
myisamchk: MyISAM file /var/lib/mysql/gts/Driver.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: MyISAM file /var/lib/mysql/gts/EventData.MYI
myisamchk: warning: Table is marked as crashed and last repair failed
myisamchk: error: Found wrong record at 7619297220
Segmentation fault (core dumped)

Is there anyway that record could be deleted or replaced? I now I might loose data but data but in worst case scenario I think if the repair do not work I could give it a try.

Any help will be appreciated.
Jun 7 '15 #1
3 3813
Luuk
1,047 Expert 1GB
Does an export work?
Expand|Select|Wrap|Line Numbers
  1. mysqldump <datbasename> EventData >EventData.sql
If this works, you should always be able to restore your data...

Did you try to restart the database?
This should take care of this message " warning: 3 clients are using or haven't closed the table properly"
Jun 7 '15 #2
Bring up your database in recovery mode is one of the methods for mysql tables, another variant is accessible and must be used if you can't find any other
You should bring down your database. Shut it down in case it’s still running and spamming these messages in your log. As last resort, you may also kill the process. In order to bring back your database you will need to start it in recovery mode, with innodb_force_recovery. You should know this recovery mode makes your databases read only. Users connecting to it can not update, insert or other way alter existing data. To prevent your MySQL getting hammered the second it comes back, I suggest you to also change port of MySQL server from 3306 to something random. Add innodb_force_recovery=1 to your my.cnf In case your server doesn’t want to come back, you may further increase this number from1 to 6, check MySQL manual to see what the differences are.
Be sure to check your MySQL logs, and if it loops with something like:
InnoDB: Waiting for the background threads to start
You should also add innodb_purge_threads=0 to your my.cnf.
So all together to bring back database, I had to add these 3 parameters in my.cnf:
port = 8881
innodb_force_recovery=3
innodb_purge_threads=0
Jun 14 '15 #3
Repairing tables with mysqlcheck or another variant to learn helpful topics about mysql databases

https://social.msdn.microsoft.com/Fo...=sqldataaccess

Repairing tables

In most cases, only the index will be corrupted (the index is a separate, smaller, file with records that point to the main data file) - actual data corruption is extremely rare. Fixing most forms of corruption is relatively easy. As with checking, there are three ways to repair tables. These all only work with MyISAM tables - to repair corruption of the other table types, you will need to restore from backup:

• The REPAIR TABLE SQL statement (obviously the server must be running for this)
• The mysqlcheck command-line utility (the server can be running)
• The myisamchk command-line utility (the server must be down, or the tables inactive)
Repairing a table requires twice as much disk space as the original table (a copy of the data is made), so make sure you are not going to run out of disk space before you start.
May 5 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jay | last post by:
Hi everybody ! I am a newbie here. I hope somebody will help with my problem. I am currently write a web-application that allow user to submit their job application online. In the job...
2
by: jaks | last post by:
How can I export a MySQL table with a different name using phpmyadmin? I want to export nuke_bbsearch_wordmatch and all it contents to phpbb_search_wordmatch This table in a different db. ...
9
by: Dejan | last post by:
Hy, Sorry for my terreble english I have this simple code for deleting rows in mysql table... Everything works fine with it. So, what do i wanna do...: my sql table looks something like...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
11
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
7
by: moazam | last post by:
Hi, I am experiencing table crash problem in my sql.. I have insert code that cause the table crash.. see this code $a = mysql_query("INSERT INTO online(session_id,odate)...
3
by: JAYO | last post by:
The MySQL table is located in a Linux Server OS, so I need the information from that table for updating Paradox tables in Windows OS. If a PHP program in the Linux Server can save a file with the...
3
by: eyik | last post by:
Dear fellow members. In my workplace, we have an application using php MySQL which functionality is basically storing data from user input. The condition is like this, we have one computer act...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.