Page 1 of 1

mysql error 1036 - table "xxx" is read only...

Posted: Wed Dec 18, 2002 10:37 am
by cyko
i backuped my files from windows xp to a cd. went on unix and mounted the cd and copied the database including my whole site files to there corresponding directories. after this i kept getting "error 1036: table "user" is read only". i tried everything to fix this....i still cant fix it...

any help is welcome :roll:

Posted: Wed Dec 18, 2002 1:55 pm
by BDKR
Check the user and group settings for that db. That error normally means that mysql can't access the db directory becuase it belongs to a different users. Here is what you do.

From a terminal like xterm, aterm, or wterm.

1) Change to the mysql/data directory. I don't know for sure where that is on your system, but on most, it's in /usr/local/mysql/data.

2) type in ls -l -h. All of the database directories should be owned by mysql and the group should say mysql. Look at the lines below.

drwx------ 2 mysql mysql 4.0k Nov 8 14:57 mysql
drwx------ 2 mysql mysql 4.0k Dec 11 12:34 Racing

The third and fourth columns from the left are the user and group. If in your system it says soemthing else, mysql won't have access to those directories.

3) If you need to change the owner and group info, make sure you're root, then type in...

chown -R mysql.mysql myFooQL (myFooQL being the name of your database)

The "-R" switch tells it to change all the files in the directory. Not just the directory itself. You can get more info concerning chown by typing...

man chown

You've got to realize also that you're coming from Windows where things like file and directory ownership are alien concepts. It takes a while to get your head wrapped around things in the *nix world, but it's worth it.

Cheers,
BDKR

Posted: Wed Dec 18, 2002 4:07 pm
by cyko
i did as u said. and when i checked the permissions they all said mysql and mysql....and the permissions was the same. i have no clue what to do now....

Posted: Thu Dec 19, 2002 2:06 pm
by BDKR
Hmmmmm.....???? Did you check that all the MYI, MYD, and frm files within those directories are mysql mysql?

Try skipping the grant tables on start up. Go to the mysql directory and try typing in
bin/safe_mysqld --skip-grant-tables &
Let's see if that works.

Another option is to take a completely different tack on this. Do the databases still exist on the XP box? If that's the case, you can use mysqldump to populate a backup database. Just use mysqladmin to create the databases on the Unix box. There will be no tables of course. After that's done, and if you can access the XP box across the network, type in a command like this one...
mysqldump -h 'the ip of the xp box' -P 'if you are not using the standard port' -u 'the user name' -p 'the password. It will prompt you' dbname | mysql dbname
another exmple may be
mysqldump -h 192.168.15.16 -u bushmaster -p dbname | mysql dbname
I do stuff like this all the time. It may be the trick. Of course, you could also just dump the db out to a text file then read back in on the Unix box.
mysql dbname < dumpfile.txt
Let me know....

Cheers,
BDKR