4

I'm curious if there is any error logging by the MySQL database when I execute a query. I know that I call mysql_error to retrieve an error but is there some other logging on database side?

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247

3 Answers3

7

By default mysql does not log queries. But you can increase the log level at the sql configuration files. Try the file: /etc/mysql/my.cnfand uncomment the line

general_log             = 1

For performance, it is off by default.

samura
  • 4,375
  • 1
  • 19
  • 26
0

Well, if it's properly set up, then it should be. It usually is by default. You can get more info in the MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/server-logs.html

Also, if you use *nix or BSD, the logs are usually stored in /var/log/ .

Peter Trobec
  • 849
  • 1
  • 9
  • 22
-2

what do you mean like empty querys or bad querys?

   $sql = mysql_query( select * from table );
// but theres no rows you would right a if statment with mysql_num_rows
if(mysql_num_rows($sql) > 0){

}else{
// error message here for empty
}

// or
 mysql_query(......)or die(mysql_error());
// this will tell you why its returnig false!