Mysterious MySQL Table 'name' is read only permission error problem.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Mysterious MySQL Table 'name' is read only permission error problem.
Hi,
I had a system disk die on an old Suse server. I never got it to boot again. I had a number of MySQL databases on another disk and I managed to save them, but I have only the .frm, .MYD and .MYI files, not a proper backup or mysqldump.
For my new Suse replacement server, I hacked them in:
1) make a directory with the name of the database in /var/lib/mysql
2) copy the .frm file to this new directory
3) make a ln -s from the .MYD and .MYI files to this new directory.
4) Set ownership to me and group to mysql for new dir and all files
5) Give mysql rw permissions on all files
6) restart MySQL and it magically sees all databases and can update them.
I did exactly the same thing on my new Ubuntu 8.04 workstation. I want to work on some of the large databases locally. I have given unlimited 777 permissions to every file and directory and made mysql the group for everything and it still complains about "Table 'all' is read only".
I have a firm rule about separating data from system. I do a partition backup of "/dev/sdb2" which is mounted on "/" and get everything except for pictures, music, videos, etc. which I backup with tar or simple file copies. One minor exception I make is for .frm files (sort of system files) and tiny .MYI and .MYD files which are neglibibly tiny. All large data files go on a large data disk, not /.
This way, I can compress my entire system image and fit it all on one DVD with Mondo.
I have set the least restrictive permissions on everything owned by the PIC database:
brianp@godzilla2:/var/lib/mysql/pic$ ll /var/lib/mysql
total 21M
-rw-r--r-- 1 mysql mysql 0 2008-10-06 13:38 debian-5.0.flag
-rw-rw---- 1 mysql mysql 10M 2008-10-08 10:01 ibdata1
-rw-rw---- 1 mysql mysql 5.0M 2008-10-08 10:12 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M 2008-09-26 09:17 ib_logfile1
drwxr-xr-x 2 mysql mysql 4.0K 2008-10-06 13:38 mysql
-rw------- 1 mysql mysql 7 2008-09-26 09:17 mysql_upgrade_info
drwxrwxrwx 2 brianp mysql 4.0K 2008-10-07 17:28 pic
The "pic" datbase is the one I am trying to get to. Its 777 permissions.
In the pic database directory, all of the .frm files are plain files, not links and again have fully open permissions:
brianp@godzilla2:/var/lib/mysql/pic$ ll /var/lib/mysql/pic
total 96K
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 attr.frm
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 attr.MYD -> /r5/mysql/pic/attr.MYD
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 attr.MYI -> /r5/mysql/pic/attr.MYI
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 disc.frm
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 disc.MYD -> /r5/mysql/pic/disc.MYD
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 disc.MYI -> /r5/mysql/pic/disc.MYI
-rwxrwxrwx 1 brianp mysql 9.0K 2008-10-07 17:28 exif.frm
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 exif.MYD -> /r5/mysql/pic/exif.MYD
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 exif.MYI -> /r5/mysql/pic/exif.MYI
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 file.frm
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 file.MYD -> /r5/mysql/pic/file.MYD
lrwxrwxrwx 1 brianp mysql 22 2008-10-07 17:28 file.MYI -> /r5/mysql/pic/file.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 keyword.frm
lrwxrwxrwx 1 brianp mysql 25 2008-10-07 17:28 keyword.MYD -> /r5/mysql/pic/keyword.MYD
lrwxrwxrwx 1 brianp mysql 25 2008-10-07 17:28 keyword.MYI -> /r5/mysql/pic/keyword.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 thumbnail.frm
lrwxrwxrwx 1 brianp mysql 27 2008-10-07 17:28 thumbnail.MYD -> /r5/mysql/pic/thumbnail.MYD
lrwxrwxrwx 1 brianp mysql 27 2008-10-07 17:28 thumbnail.MYI -> /r5/mysql/pic/thumbnail.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 toenail_dvd.frm
lrwxrwxrwx 1 brianp mysql 29 2008-10-07 17:28 toenail_dvd.MYD -> /r5/mysql/pic/toenail_dvd.MYD
lrwxrwxrwx 1 brianp mysql 29 2008-10-07 17:28 toenail_dvd.MYI -> /r5/mysql/pic/toenail_dvd.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 toenail_hd.frm
lrwxrwxrwx 1 brianp mysql 28 2008-10-07 17:28 toenail_hd.MYD -> /r5/mysql/pic/toenail_hd.MYD
lrwxrwxrwx 1 brianp mysql 28 2008-10-07 17:28 toenail_hd.MYI -> /r5/mysql/pic/toenail_hd.MYI
Going through to the links to the .MYD and .MYI files, they too have 777 permissions:
brianp@godzilla2:/var/lib/mysql/pic$ ll -L /var/lib/mysql/pic
total 30G
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 attr.frm
-rwxrwxrwx 1 brianp mysql 2.3M 2007-09-26 19:42 attr.MYD
-rwxrwxrwx 1 brianp mysql 3.1M 2007-09-28 09:53 attr.MYI
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 disc.frm
-rwxrwxrwx 1 brianp mysql 1.4M 2007-09-26 19:42 disc.MYD
-rwxrwxrwx 1 brianp mysql 4.0K 2007-09-28 09:53 disc.MYI
-rwxrwxrwx 1 brianp mysql 9.0K 2008-10-07 17:28 exif.frm
-rwxrwxrwx 1 brianp mysql 4.2M 2007-09-26 19:51 exif.MYD
-rwxrwxrwx 1 brianp mysql 617K 2007-09-28 09:53 exif.MYI
-rwxrwxrwx 1 brianp mysql 8.7K 2008-10-07 17:28 file.frm
-rwxrwxrwx 1 brianp mysql 5.7M 2007-09-26 19:51 file.MYD
-rwxrwxrwx 1 brianp mysql 5.0M 2007-09-28 09:53 file.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 keyword.frm
-rwxrwxrwx 1 brianp mysql 39K 2007-09-26 19:51 keyword.MYD
-rwxrwxrwx 1 brianp mysql 22K 2007-09-28 09:53 keyword.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 thumbnail.frm
-rwxrwxrwx 1 brianp mysql 1.1G 2007-09-26 19:51 thumbnail.MYD
-rwxrwxrwx 1 brianp mysql 431K 2007-09-28 09:53 thumbnail.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 toenail_dvd.frm
-rwxrwxrwx 1 brianp mysql 25G 2007-09-26 19:51 toenail_dvd.MYD
-rwxrwxrwx 1 brianp mysql 1007K 2007-09-28 10:01 toenail_dvd.MYI
-rwxrwxrwx 1 brianp mysql 8.5K 2008-10-07 17:28 toenail_hd.frm
-rwxrwxrwx 1 brianp mysql 3.4G 2007-09-26 19:43 toenail_hd.MYD
-rwxrwxrwx 1 brianp mysql 71K 2007-09-28 10:02 toenail_hd.MYI
I have checked all of the directories leading up to the linked files:
brianp@godzilla2:/var/lib/mysql/pic$ ll / | grep r5
drwxrwxrwx 7 brianp root 4.0K 2008-10-08 10:46 r5
brianp@godzilla2:/var/lib/mysql/pic$ ll /r5
<snip>
drwxrwxrwx 7 brianp mysql 4.0K 2008-10-07 13:15 mysql
Hi,
Some funky, protect you from yourself service called apparmor is apparently the problem here. I once found it infesting a network interface and when I eradicated it, my network worked again.
Here's the recipe:
sudo vi /etc/apparmor.d/usr.sbin.mysqld
Add the line: /r5/mysql/** rwk,
The "/r5/mysql" is the large data disk and directory where I stashed my umpteen gigabyte .MYD and .MYI files which I linked to my new database directories in /var/lib/mysql. The "** rwk" I copied from the /var/lib/mysql entry without having any idea as to what it means. Use at your own risk.
(the ** means all-all files? Read Write and K???)
Of all the servers I have running, only my printer and my database are "armored". As if somebody is going to steal my printer. One would have to think that Apache, Samba and SSH would be far better candidates for armoring than CUPS!
Again, this is for Ubuntu 8.04 running mysql installed from yast and trying to follow symbolic links to the raw data files.
> Most, if not all, programs installed will be owned as root.
That's all well and good if it is handled in the correct way. The implementation blunder on the part of ubuntu is to make it impossible to actually use the LAMP tools they installed without performing brain surgery on their setup.
Can you imagine installing Firefox and not being able to set your network proxy? Running Thunderbird without being able to input your email address? Installed programs which are impossible for the user to configure are often completely useless.
They may need some sudo voodoo behind the scenes to make their os and their applications play well together.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.