Tech Thought

Tech tips, hints, and general musings. PHP, Perl, Mysql, Javascript, AJAX, JSON, Linux, Mac OSX

Entries Tagged ‘mysql’

How-To: Create my.cnf file in MAMP

This is a simple process, however not something I could find documented anywhere easy to find. MAMP supplies you with a range of sample configuration files: /Applications/MAMP/Library/share/mysql/my-huge.cnf /Applications/MAMP/Library/share/mysql/my-innodb-heavy-4G.cnf /Applications/MAMP/Library/share/mysql/my-large.cnf /Applications/MAMP/Library/share/mysql/my-medium.cnf /Applications/MAMP/Library/share/mysql/my-small.cnf To setup one of these for MAMP, simply issue the following command: sudo cp /Applications/MAMP/Library/share/mysql/my-choicehere.cnf /Applications/MAMP/Library/my.cnf

Comments (2)

How-To: Add days to a date with Mysql

A common thing you need to do in mysql is add an interval of time to a date in a query.  Here is a simple example of how to do this: SELECT Risk.* FROM Risk WHERE (Risk.Next_Reminder_Due IS NULL OR Risk.Next_Reminder_Due < DATE_ADD(NOW(), INTERVAL 7 DAY)) This returns all ‘risks’ that either have a Next [...]

Leave a Comment

How-To: Create a mysql friendly date with php

This is really simple – and quite useful if you are trying to insert a date into mysql and you can’t use the “now()” mysql command (due to say a timezone difference): $date = date(“Y-m-d G:i:s”);

Leave a Comment

How-To: Resyncronise a mysql replication slave

Recently we’ve been having some problems with our production server. Every now and then it just reboots – for no aparent reason. We’re still looking into the reason this occurs (looks like an overheating CPU) however when the reboot occurs, it causes our Mysql replication slaves to get out-of-sync with the master.

Leave a Comment

How-To: Setup Mysql Replication – A simple guide

The following is a simple guide to help you setup Mysql replication – a fantastic way to ensure you have an up-to-date backup of your production databases. This guide only describes a single master-slave relationship, however you can use mysql in various modes which include additional slaves as required.

Comments (1)

CSV to SQL Converter – Now supports UPDATE statements

I’ve modified my CSV to SQL conversion tool (csv2sql.com) so that it now can produce both INSERT and UPDATE SQL statements from your CSV file.  Previously the tool only created INSERT statements, so you could easily insert all your CSV data into your database table.   However this is rather limited – what if you want to [...]

Comments (1)

Best Free Mac OS X Applications

Recently I upgraded to a new Mac. I like to install applications from scratch when I upgrade, as it allows me to clean out all the garbage that I didn’t need in the first place. So I’ve compiled a list of all the best free applications I like to have installed on my Mac. Must [...]

Comments (2)