Install MySQL Time Zone Support on MAMP Pro

To setup the ability to use time zone features in MySQL like CONVERT_TZ(), for example, you need to setup time zone support in your MySQL install.  These steps are specifically for MAMP Pro, but will work for any install as long as you change the paths appropriately. Open Terminal Run the following command… [code]/Applications/MAMP/Library/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo/ […]

Dump & Import a MySQL Database

The below statements assume some options are being used such as –add-drop-table, –add-locks and gzip compression.  These are optional. Dump Database NOTES: –single-transaction and –quick are added to prevent taking down a site when dumping a large DB (thanks to this post) –routines=true tells the dump to include store procedures, if applicable Import Database View […]

Stuff to Fix After Updating Mac OSX or Restoring From a TimeMachine Backup

These are steps I needed to perform after moving to a new machine and restoring it from a TimeMachine backup. Restore Apache and PHP Settings Restore httpd.conf and php.ini files. Fix Apache You should also run the following to see if there are any other errors and fix as needed Fix PHP You should also test […]

How to Setup a LAMP Stack on CentOS

For the purpose of this tutorial, we will use yourdomain.tdl as our domain.  Anytime you see something like {yourdomain.tdl} or anything similar enclosed in curly braces, please replace with the text specific for your setup. Install Apache Server on CentOS Install [code]yum install httpd[/code] Set to startup Apache on boot [code]chkconfig –levels 235 httpd on[/code] […]

Determine MySQL Version via Command Line

Want to find out what version MySQL you are running using only your command line interface? This one is super easy. Log in to MySQL (replace “root” with your username of choice or keep as root) mysql -u root -p Enter your password when prompted Run the following statement SHOW VARIABLES LIKE “%version%”; Your output […]

How to Fix Slow Product Saves in Magento

In earlier versions of Magento you may have noticed that saving products is horribly slow especially as your site grows.  This problem originates from a bug in MySQL 5 (bug #42259) where using “IN” can dramatically decrease performance.  This appears to have been corrected in Magento 1.7.x.  However, if upgrading isn’t an option for you […]

Selectively Dump Data with mysqldump

You can dump part of a table using the mysqldump in command line.  The command is… The “-t” flag will suppress the “DROP” and “CREATE” commands so you will be left with a clean “INSERT” statement that you can load where ever needed. You can also use a shortcut for the “where” by using just […]

Create MySQL Database and Add New User (command line)

Here is a quick example of how to create a database, assign a new user and set their password. Connect to MySQL server as user “root” (you will be prompted for a password) The “mysql>” prompt will now appear. Create new database… we’ll call it “orders” Give user (named “fluffy”) full permissions Set password for […]