Category: 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 […]

  • Get SSL running on Apache (CentOS)

    I was playing with a new virtual server that had CentOS installed on it recently, and wanted to get SSL working for Apache.  Since I was only setting up a development server I really didn’t need to purchase a certificate and decided to use a self-signed certificate.  Here is what I did: First I needed […]

  • 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, […]