mysql: capitalize first word of all words

credits to: http://joezack.com/2008/10/20/mysql-capitalize-function/   create a function:   CREATE FUNCTION CAP_FIRST (input VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC BEGIN DECLARE len INT; DECLARE i INT; SET len = CHAR_LENGTH(input); SET input = LOWER(input); SET i = 0; WHILE (i < len) DO […]

mysql: min value per group

surprisingly, to find the min date per company, which is a super basic query, on mysql you need to do a complicated query.    SELECT a.id, a.company, a.email, a.custom_last_email FROM leads a INNER JOIN ( SELECT company, MIN(custom_last_email) mindate FROM […]

phpmyadmin: securing web console

I installed PHPMyadmin to check my help manage my database, eventhough I also use the desktop program MySQL Workbench, I fell sometimes its important to use the webconsole. Recently, upon checking my MySQL Logs (/var/logs/mysql/error.log) I encountered that everyday I […]

mysql: enable logging

mysql> show variables like ‘%log%’; Recreate the log files I deleted by mistake. It appears the MySQL does not recreate them automatically. touch /var/log/mysql.log chown mysql:adm /var/log/mysql.log touch /var/log/mysql/error.log chown mysql:adm /var/log/mysql/error.log touch /var/log/mysql/mysql-slow.log chown mysql:adm /var/log/mysql/mysql-slow.log touch /var/log/mysql/mysql.log chown […]