Tag: MySQL

  • Finding Duplicates using SQL

    While migrating old data to a new database schema I was unable to activate a PRIMARY KEY on the legacy_customer_id field because there were duplicates. It turned out that the old application did not clean the data really well, and it allowed duplicates to be created where one of the customer_ids had a space character […]

  • Linux backup using CRON to local directory

    As many have pointed out I am on a backup and disaster recovery kick lately. Some would say that it is about time, others are simply glad to see that data is now being backed up. I have found that it is easiest to zip up files on a local machine prior to moving them […]

  • MySQL not creating mysql.sock and broken on Hardy Heron

    Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin. In command line I would get “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”, and with PHPMyAdmin I would get “#2002 – The server is not responding (or the local MySQL server’s socket […]

  • SSH port forwarding/tunneling for MySQL connection

    Create an account on the remote MySQL database server. useradd -s /bin/false remote_user mkdir /home/remote_user/.ssh touch /home/remote_user/.ssh/authorized_keys chown -R remote_user:remote_user /home/remote_user/.ssh chmod 755 /home/remote_user/.ssh chmod 600 /home/remote_user/.ssh/authorized_keys Add MySQL permissions in the remote MySQL database to allow user connections from localhost. USE mysql; GRANT ALL ON db.* TO [email protected] IDENTIFIED BY ‘database_pass’; FLUSH PRIVILEGES; Now, […]

  • Using JOIN within the Zend Framework

    I found documentation very sparse on the subject of using JOIN with the Zend Framework. So i set out on a quest of many hours figuring out how to get it to work. Here is what I ended up with. I do not claim that this is the best way to do it, or that […]