Quantcast
Channel: GeekyBoy.com » MySQL
Browsing latest articles
Browse All 10 View Live

Cleaning duplicate records with SQL

I needed a way to clean out a MySQL table of records with duplicate email addresses. To do this I used a simple SELECT query inside of an INSERT. INSERT INTO good_users(email) SELECT DISTINCT(email)...

View Article


MySQL ADDDATE or DATE_ADD

This weekend I needed a couple of MySQL query items that were out of the ordinary, so I thought I would write about them. ADDDATE or DATE_ADD both work the same, but came in very handy. I was...

View Article


MySQL FIND_IN_SET

I was faced with a field in the database that had a comma separated list of INT’s with a space after the comma. The application searched this field to generate the recordset to display on a web page....

View Article

Getting differences between dates quickly in PHP or MySQL

I recently needed a way to figure out the difference, in days, between two dates. Here is how I did it. Using PHP: $expireDate = "2006-02-07";   $year = substr($expireDate, 0, 4); $month =...

View Article

MySqlDump export and MySQL import

To export data as a backup you can’t beat mysqldump. # mysqldump -u username database > database_2007-05-14.sql Then to restore a database you would use: # mysql -u username -p database <...

View Article


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...

View Article

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...

View Article

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...

View Article


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...

View Article


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...

View Article
Browsing latest articles
Browse All 10 View Live