Error on rename 'x.frm' to 'y.frm' - Errcode: 13 - Permission denied - MySQL

最后都变了- 提交于 2019-12-11 15:19:47

问题


Ok, I know there is so many questions about this issue but, since I could not find a answer to solve my problem (I tried so many many many workarounds!!) and it made me to waste 4 hours of my work, and now I found where my problem were in, I would like to share and keep here also for my own future reference.

The problem

Error on rename of '.\db_testes\#sql-1f1c_1a.frm' to '.\db_testes\alteracaocrono_ateste.frm' (Errcode: 13 - Permission denied) that was happening when creating an index in a MySQL table just after to create it.

Why is this SO strange?
1. Because it was happening in a script were I had so many others 'create table's and 'create index' that were working fine just before the error happen;
2. Because everytime I tried it after cleaning the database to run it again, that error occurred in a different place, a different index each time!;
3. Because all folders related to MySQL had FULL-CONTROLL permissions for 'everybody' (I was desperate, I know);

Checking perror 13 I was getting 'Win32 - the data is invalid'. No much informative at all.

What I had tried

  1. Change the tmpdir of MySQL (in mysql.ini) to c:\temp (unfortunately, I have to use windows to programming in my work!);
  2. Change all the data folder and all mysql folder;
  3. So many restarts (for the sake the Windows way to exist);
  4. Remove and reinstall MySQL in a different folder;
  5. Change permissions to full-controll in tmpdir and mysql data folders;

Please, see my answer to know how I solved it.


回答1:


Solution

Finally, what solved the problem to me was: change the index name!

But wait, the name was not repeated! I had looked for it right in the first time! And it also was not too long! It was similar to others in the same script. It *had not special chars!** It was something like IX_TAB_ABC_123. So, how in the world would somebody to guess what the problem was??. For some reason, MySQL just didn't like the name I pick but it did not let me know why!!

My conclusion

When you make a software, please, dont be stupid! Put significative error messages on it! By "significative" I mean clear and objective error messages pointing the exact problem, the reason and, when possible, the solution. The world will be a better place if you just do it, believe me!

Hope it helps anybody else having this stupid problem!



来源:https://stackoverflow.com/questions/51373910/error-on-rename-x-frm-to-y-frm-errcode-13-permission-denied-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!