0

I'm getting this error. I tried Googling, searching through StackOverflow, but I couldn't find the same error code. Here's what I get:

#7 - Error on rename of './wp_data/products_per_store.frm' to './wp_data/#sql2-c16-40.frm' (Errcode: 1)

When trying to run this query:

ALTER TABLE `products_per_store`
DROP `brand`,
DROP `upc`, 
DROP `price_increase`, 
DROP `price_decrease`, 
DROP `oos_certeincomp`, 
DROP `oos_allcomp`, 
DROP `flagged`, 
DROP `optimal`, 
DROP `low`;

I'm on XAMPP on Linux (Fedora 18 if that matters). I tried changing file permissions but it didn't help, restarting MySQL didn't either.

casraf
  • 21,085
  • 9
  • 56
  • 91
  • Does `./wp_data/products_per_store.frm` exists? Do mysql have write permissions to `./wp_data` directory? – piotrekkr May 08 '13 at 09:53
  • Did you recently upgraded MySQL? In that case, run mysql_upgrade. Other possible causes... did you discard a tablespace? Is there a FK in another table which refers to one of the fields you are trying to drop? – Federico Razzoli May 08 '13 at 09:57
  • Yes, the entire directory of data is 7777. And no, I haven't upgraded MySQL recently. – casraf May 08 '13 at 10:18
  • It's possible that there is no execute permission for some directory somewhere in the path to `wp_data`. Can you check every directory in full path if there is execute permission for mysql user? Something like: `sudo -u mysql cp /path/to/wp_data/products_per_store.frm /path/to/wp_data/products_per_store.frm.tmp` – piotrekkr May 08 '13 at 11:09
  • You can also read here: http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me it is possible that it is not rename error but foreign key erorr. – piotrekkr May 08 '13 at 11:12
  • The error there is different. And the command was successful, the privs are okay. – casraf May 08 '13 at 12:57

1 Answers1

1

After playing around with all kinds of permissions, here's the deal.

MySQL is running under user nobody (and not mysql as I had assumed) on Linux, Changing the directory and it's descendants' owner and group to nobody worked. Also make sure permissions are at least 755.

casraf
  • 21,085
  • 9
  • 56
  • 91
  • It that's the problem, I'd say the appropriate solution would be to run MySQL with an appropriate user, rather that letting anyone fiddle with the data files. – Álvaro González May 08 '13 at 15:18
  • It used to work, I don't know what caused the issue to suddenly come up. Permission was suddenly denied even to me as a GUI user, and only with access to root. It shouldn't be like that. It's not world-writable, but it's not guarded by root either. I don't run mysql as root. – casraf May 08 '13 at 15:34
  • After checking around a bit, this is the default user used on MySQL files for XAMPP. I apparently changed it by mistake or in an attempt to make it easier to edit files without having to request superuser access. – casraf May 30 '13 at 08:31