From: Thimble Smith Date: February 22 2000 7:27am Subject: corrupt mysql/{db,user}.MYI after GRANT List-Archive: http://lists.mysql.com/bugs/10 Message-Id: <20000222072706.33166.qmail@threads.polyesthetic.msg> >Description: After performing a simple GRANT statement, my db and user privilege tables are corrupted: root@threads:/var/db/mysql# myisamchk -s mysql/*.MYI myisamchk: MyISAM file mysql/db.MYI myisamchk: warning: Not used space is supposed to be: 151 but is: 0 myisamchk: error: record delete-link-chain corrupted myisamchk: error: Found 3 keys of 2 MyISAM-table 'mysql/db.MYI' is corrupted Fix it using switch "-r" or "-o" myisamchk: MyISAM file mysql/user.MYI myisamchk: warning: Not used space is supposed to be: 107 but is: 0 myisamchk: error: record delete-link-chain corrupted myisamchk: error: Found 3 keys of 2 MyISAM-table 'mysql/user.MYI' is corrupted Fix it using switch "-r" or "-o" root@threads:/var/db/mysql# myisamchk -r mysql/*.MYI - recovering MyISAM-table 'mysql/columns_priv.MYI' Data records: 0 - Fixing index 1 --------- - recovering MyISAM-table 'mysql/db.MYI' Data records: 2 - Fixing index 1 - Fixing index 2 Data records: 3 --------- - recovering MyISAM-table 'mysql/func.MYI' Data records: 0 - Fixing index 1 --------- - recovering MyISAM-table 'mysql/host.MYI' Data records: 0 - Fixing index 1 --------- - recovering MyISAM-table 'mysql/tables_priv.MYI' Data records: 12 - Fixing index 1 - Fixing index 2 --------- - recovering MyISAM-table 'mysql/user.MYI' Data records: 2 - Fixing index 1 Data records: 3 >How-To-Repeat: Start mysqld, then $ mysql < corrupt.sql where corrupt.sql is: DROP DATABASE IF EXISTS foobar; CREATE DATABASE foobar; SELECT user, host FROM mysql.user; SELECT user, host, db FROM mysql.db; # note: user1@localhost does not exist yet, when I run this program GRANT ALL PRIVILEGES ON foobar.* TO user1@localhost IDENTIFIED BY 'pw1'; SELECT user, host FROM mysql.user; SELECT user, host, db FROM mysql.db; >Fix: Don't know, yet. Inserting rows into the privilege tables does not corrupt the tables; it's only when using GRANT. I don't know if this is FreeBSD-related or not; another MySQL user reported a similar thing, though (which is what got me exploring this). >Submitter-Id: >Originator: Thimble Smith >Organization: Tim Smith < tim@stripped > :MySQL Development Team: Boone, NC USA. > >MySQL support: [none | licence | email support | extended email support ] >Synopsis: corrupt mysql/{db,user}.MYI after GRANT >Severity: serious >Priority: medium >Category: mysql >Class: sw-bug >Release: mysql-3.23.11-alpha (Source distribution) >Environment: System: FreeBSD threads.polyesthetic.msg 4.0-CURRENT FreeBSD 4.0-CURRENT #1: Thu Feb 17 23:11:52 EST 2000 root@stripped:/usr/src/sys/compile/THREADS i386 Some paths: /usr/bin/perl /usr/bin/make /usr/local/bin/gmake /usr/bin/gcc /usr/bin/cc GCC: Using builtin specs. gcc version 2.95.2 19991024 (release) Compilation info: CC='gcc' CFLAGS='' CXX='g++' CXXFLAGS='' LDFLAGS='' LIBC: -r--r--r-- 1 root wheel 1127942 Feb 18 02:18 /usr/lib/libc.a lrwxr-xr-x 1 root wheel 9 Feb 18 02:18 /usr/lib/libc.so -> libc.so.4 -r--r--r-- 1 root wheel 520361 Jan 20 05:03 /usr/lib/libc.so.3 -r--r--r-- 1 root wheel 531140 Feb 18 02:18 /usr/lib/libc.so.4 Configure command: ./configure --prefix=/usr/local/mysql --localstatedir=/var/db/mysql --with-gnu-ld --with-named-thread-libs=-lc_r --with-libwrap --enable-assembler --enable-large-files --with-mysqld-user=mysqld --without-readline --with-debug Perl: This is perl, version 5.005_03 built for i386-freebsd