Earlier, I had posted (unfortunately it wasn't on this forum) that my mySQL database seemed to be getting corrupted upon $PHP queries. After doing a bunch more digging, I have at least been able to produce something in mySQL (leaving PHP out of the loop, but I saw a related post in this forum) which has me completely baffled (I am running on Win2k with mySQL 4.0.1-alpha, but
I believe the same thing was happening with 4.0.0-alpha):
Synopsis:
Whenever there is an auto_increment primary key I always get the following lines whenever I run:
myisamchk -e ..\data\photos
from the mysql\bin directory (but also happens if I go to the destination dir):
myisamchk: Can't unlock file (Errcode: 11)
- check records and index references
myisamchk: error: 11 when locking indexfile 'orignalArgToMyisamchk'
Steps to reproduce, having selected the HelpMe database:
(1) mysql> create table Test4 (col1 int unsigned NOT NULL auto_increment
PRIMARY KEY, col2 varchar(15) NOT NULL);
(2) mysql> insert into test4 set col2='paint';
(3) mysql> quit;
(4) myisamchk -e -v ..\data\HelpMe\Test4
Any enlightenment is appreciated since I'm completely stumped.
Csaba Gabor from New York
Three outputs follow (The first being, at the least, impertinent):
C:\Winapps\mySQL\bin>myisamchk -o -f -v ..\data\HelpMe\Test4
- recovering (with keycache) MyISAM-table '..\data\HelpMe\Test4'
Data records: 1
myisamchk: error: 11 when locking indexfile '..\data\HelpMe\Test4'
MyISAM-table '..\data\HelpMe\Test4' is not fixed because of errors
Try fixing it by using the --safe-recover (-o) or the --force (-f) option
C:\Winapps\mySQL\bin>myisamchk -e -v ..\data\HelpMe\Test4
Checking MyISAM file: ..\data\HelpMe\Test4
Data records: 1 Deleted blocks: 0
- check file-size
- check key delete-chain
block_size 1024:
- check record delete-chain
No recordlinks
- check index reference
- check data record references index: 1
myisamchk: Can't unlock file (Errcode: 11)
- check records and index references
myisamchk: error: 11 when locking indexfile '..\data\HelpMe\Test4'
C:\Winapps\mySQL\bin>myisamchk -d -v ..\data\HelpMe\Test4
MyISAM file: ..\data\HelpMe\Test4
Record format: Packed
Character set: latin1 (8)
File-version: 1
Creation time: 2002-04-28 17:30:21
Status: changed
Auto increment key: 1 Last value: 1
Data records: 1 Deleted blocks: 0
Datafile parts: 1 Deleted data: 0
Datafile pointer (bytes): 4 Keyfile pointer (bytes): 4
Datafile length: 20 Keyfile length: 2048
Max datafile length: 4294967294 Max keyfile length: 4398046510079
Recordlength: 19
table description:
Key Start Len Index Type Rec/key Root Blocksize
1 1 4 unique unsigned long 1 1024 1024