Results 1 to 2 of 2

Thread: Killing MySQL process with PHP

  1. #1
    nyx Guest

    Killing MySQL process with PHP

    I'm looking for a method for killing a specific MySQL process with PHP.

    The application allows users to potentially create very large queries to the database and I need to provide a method for them to kill / cancel the query if they wish.

    I've seen a couple of examples of scripts which loop through the process list and kills processes which have been running for longer than a specified period, but I'm looking for something more specific.

    Thanks in advance

  2. #2
    Join Date
    Feb 2007
    Location
    Ireland
    Posts
    1,007
    Only the operating system has ultimate control over processes. PHP has no power to intervene in MySQL processes unless it asks the operating system to do it (via a script) or MySQL allows it to, which it does.

    MySQL provides SQL queries to view and kill processes. You can run these queries using PHP. This has it's limits as your database server could be choking, where running these queries may have no effect as they may never reach the database. At that point executing a script on the system may be an alternative option.

    Have a look at the KILL syntax.
    “The best thing about a boolean is even if you are wrong, you are only off by a bit.”

Similar Threads

  1. Replies: 0
    Last Post: 08 Feb 2006, 02:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •