LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Unable to delete files of MySQL (https://www.linuxquestions.org/questions/red-hat-31/unable-to-delete-files-of-mysql-373771/)

laguna01 10-16-2005 10:40 PM

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

david_ross 10-17-2005 03:06 PM

Did you run the upgrade scripts to convert the databases?

laguna01 10-17-2005 08:20 PM

Quote:

Originally posted by david_ross
Did you run the upgrade scripts to convert the databases?
Yes, I did but I received the error messages saying that these tables is readonly.

david_ross 10-19-2005 12:12 PM

Is the filesystem mounted as readonly? What do you get from running "mount"?

laguna01 10-20-2005 04:31 AM

Quote:

Originally posted by david_ross
Is the filesystem mounted as readonly? What do you get from running "mount"?
Hi david_ross, here is what I got from running "mount":

[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

david_ross 10-20-2005 12:22 PM

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?

KimVette 10-20-2005 12:43 PM

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)

laguna01 10-21-2005 04:51 AM

Quote:

Originally posted by KimVette
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)


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.