Unable to delete files of MySQL
Hi all!
I am trying to remove MySQL 3.23 in order to install MySQL 4.1 on Linux AS3.0. The problem is after I uninstalled the old version, I cannot update or insert to some tables of the database 'mysql'. Below is the list of tables: columns_priv db func host tables_priv user For example, everytime I tried to insert or update the table user, I always got the following message: "ERROR 1036 (HY000): Table 'user' is read only" I thought that it might be something wrong with the file access permission but when check that with ls -Al under the folder /var/lib/mysql/mysql , Linux shows me below info: -rw------- 1 mysql root 8778 Jun 7 14:36 columns_priv.frm -rw------- 1 mysql root 0 Jun 7 14:36 columns_priv.MYD -rw------- 1 mysql root 1024 Jun 7 14:36 columns_priv.MYI -rw------- 1 mysql root 8982 Jun 7 19:34 db.frm -rw------- 1 mysql root 453 Jun 13 14:09 db.MYD -rw------- 1 mysql root 3072 Jun 13 14:11 db.MYI -rw------- 1 mysql root 8641 Jun 7 14:36 func.frm -rw------- 1 mysql root 0 Jun 7 14:36 func.MYD -rw------- 1 mysql root 1024 Jun 7 14:36 func.MYI -rw------- 1 mysql root 8958 Jun 7 14:36 host.frm -rw------- 1 mysql root 0 Jun 7 14:36 host.MYD -rw------- 1 mysql root 1024 Jun 7 14:36 host.MYI -rw------- 1 mysql root 8877 Jun 7 14:36 tables_priv.frm -rw------- 1 mysql root 0 Jun 7 14:36 tables_priv.MYD -rw------- 1 mysql root 1024 Jun 7 14:36 tables_priv.MYI -rw------- 1 mysql root 9148 Jun 7 14:36 user.frm -rw------- 1 mysql root 1926 Jun 14 15:00 user.MYD -rw------- 1 mysql root 2048 Jun 14 16:40 user.MYI Since I login as root, file permission should not be a problem but I still tried to change it with chmod and below is what I always get: chmod: changing permissions of `user.MYI': Operation not permitted I then tried to remove the file user.MYI manually by using rm –f user.MYI but failed: rm: cannot remove `user.MYI': Operation not permitted I don’t understand why I cannot do it even I logon as root user. It looks like something has locked down these files and even MySQL cannot access to them. That is why MySQL think these files are readonly, I guest. Could anyone please give me some hints to solve this problem? Any feedback is appreciated Regards Adrian Mai |
Did you run the upgrade scripts to convert the databases?
|
Quote:
|
Is the filesystem mounted as readonly? What do you get from running "mount"?
|
Quote:
[root@test /]# mount /dev/hda1 on / type ext3 (rw) none on /proc type proc (rw) usbdevfs on /proc/bus/usb type usbdevfs (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw) I dont really understand what does that mean, any clue? Thanks |
The rw means it is mounted as read/write. I'm surprised it's doing this. Can you create new files in that directory:
date > /var/lib/mysql/mysql/date.test cat /var/lib/mysql/mysql/date.test rm -f /var/lib/mysql/mysql/date.test Does that create a file with the date and then delete it ok? |
Two things:
1. To rule out file ownership could you chown -R the mysql directories? (You can always chown them back to mysql if necessary) 2. You're on ext3, which supports the immutable attribute. Can you create a link to that file? If no: You happen happen to have that bit set. In such cases, even root cannot delete the file until that bit is unset. (man chattr) |
Quote:
Hi KimVette and david_ross I think KimVette are right, I unset the immutable attribute for the whole mysql folder and now I can delete it. It's really interesting and now I can have MySQL on my server, thank you very much for your helps. |
All times are GMT -5. The time now is 07:53 PM. |