Mehic.info

Category Archives: Web

Posts related to web design and programming web applications.

Monitor live MySQL queries

Log to your mysql with mysql -u username -pPassword and execute: mysql> SHOW VARIABLES LIKE “general_log%”; +——————+—————————-+ | Variable_name | Value | +——————+—————————-+ | general_log | OFF | | general_log_file | /var/run/mysqld/mysqld.log | +——————+—————————-+ mysql> SET GLOBAL general_log = ‘ON’; Then in another terminal execute tail -f -n300 /var/run/mysqld/mysqld.log Then don’t forget to disable general_log […]

Categories: Web
Read more

Quick way to remove duplicates from MySQL database

DROP TABLE IF EXISTS tmp;create table tmp like mytable; ALTER TABLE tmp ADD UNIQUE INDEX(text1, text2, text3, text4, text5, text6); insert IGNORE into tmp select * from mytable; delete from mytable where id not in ( select id from tmp); DROP TABLE IF EXISTS tmp;

Read more

Installing PHPUnit On Windows

Assuming you already have PHP and MySQL installed, here’s the steps you need to take. Install PEAR, a dependency for PHPUnit: Visit http://pear.php.net/go-pear.phar in your browser and save the file into your PHP directory. This is the folder where you can find php.exe. Open an administrator command prompt. On Vista or Windows 7, hit your Windows […]

Read more