MySQL  

What happens when you restart MySQL (WAMP’s database service)?

What happens when you restart MySQL (WAMP’s database service)?

  • Active connections are dropped → any application connected to MySQL will lose its session.

  • Running queries/transactions are aborted → if a query was in the middle of writing, MySQL will roll back that transaction (thanks to transaction logs in InnoDB).

  • Tables/data themselves are safe → MySQL ensures durability, so committed data is not lost.

  • Non-transactional tables (MyISAM) are riskier → if you still have MyISAM tables, they can become corrupted if a write was in progress when the service stopped.

Risks of Restarting Every 3 Hours

  • Apps/websites using the DB may fail while the service is down.

  • Any batch jobs, cron jobs, or API calls during restart will error out.

  • If you restart during heavy writes, performance may be affected briefly.

  • Tables themselves won’t get corrupted in InnoDB, but MyISAM tables can.

Safer Alternatives

  1. Only restart if the service fails

    • Instead of restarting every 3 hours, configure Task Scheduler to start the service if it’s stopped (health check).

    Example batch

    sc query wampmysqld64 | find "RUNNING" >nul
    if %errorlevel%==1 net start wampmysqld64
    sc query wampapache64 | find "RUNNING" >nul
    if %errorlevel%==1 net start wampapache64
    

    This way it only starts services if they’re not running.

  2. Schedule a restart during off-peak hours

    • e.g. once daily at 3 AM, when traffic is minimal.

  3. Use MySQL config for stability

    • Instead of forced restarts, tune MySQL memory, query cache, etc., so it doesn’t need frequent restarting.

Answer to your question

  • No, restarting won’t corrupt data in InnoDB tables.

  • Yes, it can cause temporary downtime and aborted queries, so apps may face errors.

  • If you use MyISAM tables, there is a small risk of corruption.