问题
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
- Change the
tmpdirof MySQL (in mysql.ini) toc:\temp(unfortunately, I have to use windows to programming in my work!); - Change all the data folder and all mysql folder;
- So many restarts (for the sake the Windows way to exist);
- Remove and reinstall MySQL in a different folder;
- Change permissions to
full-controllin 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