Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7999651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:33:54+00:00 2026-06-04T15:33:54+00:00

I have a VPS with Dreamhost but the mySQL server is shared. I really

  • 0

I have a VPS with Dreamhost but the mySQL server is shared. I really want to start producing accessible logs of every mySQL query a particular site issues.

I can hand roll this into my abstraction layer but I was curious is there was something like sql_log_off that can be set at runtime so all queries get logged into files I can rotate and review?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:33:55+00:00Added an answer on June 4, 2026 at 3:33 pm

    From what I understand of what the question is asking:
    What you could do is wrap your queries into some sort of wrapper that logs the queries into a file. This could be a text file or a PHP file that will only allow those with permission to view (a log viewer script could include this so that only those with proper access can view).

    That is of course saying if you are able to do so. (If you are wanting to log queries from sites that you have no control over then I am not sure.)

    An example of a wrapper you might be interested in:

       function sql_query($query, $show=0)
        {
         global $queries, $debugginglist;
         $thequery = mysql_query($query) or print(mysql_error()."<br>Query was: <code>".htmlspecialchars($query)."</code>");
         $queries++;
    
        if ($show == 1)
         {
          print "($queries): Query was: <i><code>".htmlspecialchars($query)."</code></i><br>";
         }
    
         $debugginglist .= "$qbr($queries): Query was: <i><code>$query</code></i><br>";
    
    
         //this is just to give an idea for logging, NOT an exact solution
         $logquery = fopen("querylog.txt", "ab+");
         fputs($logquery, "\r\n$query");
         fclose($logquery);
    
         return $thequery;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a VPS and I want to make mysql DB accept connection externally
I have a server (VPS) that hosts numerous PHP / MySQL websites. Most are
I have a VPS (Debian, Apache, MySQL, PHP) I want to force the encoding
I have VPS with 1GB of RAM. One ruby-app that runs on thin server
I have a VPS server with Ubuntu 11.10 64bit and sometimes when I execute
I've hired a new VPS and have root access. Now i want to configure
I have a Windows Server 2003 64-Bit VPS, and I'm experiencing a problem with
I have a php mail script sitting on a LAMP vps server. The script
I have a VPS Linux webserver with PHP installed. I want to code some
We have one vps server, at the moment, and we need to run both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.