Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Saturday, 7 September 2013

Enable MySQL slow query log

Posted by Sarath On Saturday, September 07, 2013 No comments
The slow query log consists of SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. It is very helpful in troubleshooting bad queries.

Add the following to /etc/my.cnf file to enable the slow query log:
Code: 
log-slow-queries=/var/lib/mysql/slow.log
After that, then do the following commands to create the file with the right ownership and file permissions:

Code: 
touch /var/lib/mysql/slow.log
Code: 
chmod 660 /var/lib/mysql/slow.log
Code: 
chown mysql:mysql /var/lib/mysql/slow.log

Done..!! I hope that was too easy..  ;)

Saturday, 6 July 2013

You may have come across this error before while trying to restore mysql databases, it can be easily fixed by increasing max_allowed_packet value. Check the current value first. Get into mysql prompt and enter the following query :
select @@max_allowed_packet;
Then you can increase the value either by adding the variable in my.cnf file or executing the query in mysql prompt :
set global max_allowed_packet = 64*1024*1024; (64 MB, change it as per your needs)
Restart mysql if you are setting the value in my.cnf file. Now check the new value using the same query we used above and try restoring the database.

Sunday, 30 June 2013

Innodb disabled - MySQL

Posted by Sarath On Sunday, June 30, 2013 No comments
First check for any disable options for innodb in /etc/my.cnf like
skip-innodb and remove them if there is any. Then restart mysql:
If that doesn't work, try
# /etc/init.d/mysql stop
# mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
# mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak
# /etc/init.d/mysql start
 To check, get into mysql prompt and use the command :
> show engines;
InnoDB is enabled by default. But, MySQL seems to disable it automatically if your InnoDB log files get corrupted. When you remove them, they are recreated, allowing InnoDB to start again.

Friday, 21 September 2012

If you already have php and Mysql installed in your system/server and still getting the error, some changes need to be made in your php.ini file,
Open your php.ini file and search for extension=php_mysql.dll, uncomment the line (remove the semicolon in the beginning of the line)
Then search for extension_dir in php.ini file and change extension_dir =”C:\php\ext” if it is not.
Note : You need two sql dll files, php_mysql.dll and libmysql.dll which together provide you PHP mysql extension, first check in ext folder (C:\php\ext) in your PHP installation location.
if you don’t have ext folder, you need to download PHP zip version (http://windows.php.net/download/) containing those required files. Then copy ext folder to your PHP installation location,also copy libmysql.dll to your PHP installation location.
libmysql.dll should be reachable in your system, so copy it to c:\windows\system32.

Once you have done the above steps, restart IIS. That will work...