Sunday, September 11, 2016

How to fix "Error on rename of mysql frm due to permission denied" error message on mysql?

Try to integrate "lucadegasperi", an OAuth  component on my application recently, I was required to patch the database by running the given patch script. I encountered error message as shown below when run the patch script.

C:\wamp\www\lumen>php artisan migrate --seed
Migration table created successfully.


  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 7 Error on rename of '.\[DATABASE_NAME]\#sql-2f6
  c_6.frm' to '.\[DATABASE_NAME]\oauth_session_scopes.frm' (Errcode: 13 - Permissi
  on denied) (SQL: alter table `oauth_session_scopes` add index `oauth_sessio
  n_scopes_session_id_index`(`session_id`))



  [PDOException]
  SQLSTATE[HY000]: General error: 7 Error on rename of '.\[DATABASE_NAME]\#sql-2f6
  c_6.frm' to '.\[DATABASE_NAME]\oauth_session_scopes.frm' (Errcode: 13 - Permissi
  on denied)

I was using a superuser account to connect to mysql database. Should not prompt this error message

Solution

  • The root cause is the Mcafee antivirus on my Windows 10 stop the MySql to edit the FRM file when "alter" command is executed.
  •  In order to run the patch script, I temporary turn off the real time scanning on my Mcafee. Launch Mcafee and click on "Virus and Spyware protection" option.
  • Select "Real-Time Scanning"option and turn off the "Real-Time scanning" option.

  • Rerun the command "php artisan migrate --seed", all tables was created successfully.

1 comment:

Profesor particular en línea said...

¡¡Muchísimas gracias amigo!!