Amazon RDS instance time zone workarounds

If you have an EC2 instance to run your application and an RDS instance for your database. On your EC2 instance you are in luck as you can easily change the time zone of the machine. Like set it to GST or by location like below

# ln -sf ../usr/share/zoneinfo/Asia/Dubai /etc/localtime

Read the rest of this entry »

How to Setup PHP, MySQL and phpMyAdmin on Mac OS X Snow Leopard

My previous working setup was on WAMP( Windows, Apache, MySQL and PHP). On Windows I used a bundled app WampServer that did the job, just install the executable and your all set.

On Mac it kinda needs a bit of work but basically you have to configure PHP, download-install MySQL and phpMyAdmin.
Read the rest of this entry »

#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

Been using WAMP for several months now and once in awhile MySQL breaks. Somehow the user tables gets corrupted. To fix the problem instead of reinstalling the whole WAMP. Just replace the corrupted files. These 3 files are always corrupted.

      user.MYI
      user.MYD
      user.frm

Download this mysqlusertables. Unzip the file, copy the 3 files inside.

Go into your C:\wamp\bin\mysql\mysql5.x.xx\data\mysql directory and paste, click yes to overwrite.

Restart All Service on your WAMP. Then you are good to go.

I’ll keep you posted soon on why these tables easily gets corrupted.

*Update*

Digging deeper to the culprit I found out the tables for users in the mysql db has warnings, meaning they are corrupt. So to avoid doing the steps above while your MySQL and phpMyAdmin is still working. Go to phpMyAdmin, access mysql db, then select users table then click on operations then under “Table maintenance” click on Repair Table. Viola!!!

No Renaming Tables feature in phpMyAdmin

Quick tip. The feature is not (yet) supported in phpMyAdmin but you can easily make the change by simply issuing this sql statement.

RENAME TABLE old_table TO new_table

Update On phpMyAdmin select a table then go to Operations, Under Table Options you would see Rename Table to feature.

Import sql dump using the MySQL client

This is useful if you don’t have access to phpmyadmin on your server but have access to ssh and ftp. Or you have a huge sql dump like 10MB or higher that you cannot import directly on phpmyadmin. In my case the phpmyadmin directory was password protected by Apache and I don’t have the right password.

First upload the .sql file on your server using an FTP client and remember the path.

eg.
For Linux
/home/lopau/mydump.sql

for Windows
C:/wamp/www/lopau/mydump.sql

Login to your server using an SSH client like Putty.

On the command line access MySQL
$> mysql -u username -p password

replace username and password with yours.

On the MySQL client command line access and use your database.
$> use lopaudb;

Now to import your dump;
$> source /home/lopau/mydump.sql;

If successful you should see
Query OK, 13 rows affected (0.00 sec)

That easy.