MySQL Replication Error 1062: ‘Duplicate entry for PRIMARY key’

If you are trying to setup MySql Master – Slave configuration and you faced ‘Duplicate Entry’ error after starting slave then you can use the following script to resolve it.

This script check slave status for  duplicate entry and if it finds one it skip that entry (since we already have it) and it keep doing it till all duplicate entry is found.


Installation Guide: Oracle JDK 7 on Ubuntu 12.04 LTS

This tutorial teaches you command based way of installing JDK from official sources. Users can use unofficial PPAs to install JDK directly but that can be dangerous.

What is JDK?
Java Development Kit. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.

Is there any PPA for the same?
There is no official PPA for this from Oracle / Ubuntu. Though unofficial PPA is available at

JDK Version: JDK 7
FileName: jdk-7u51-linux-x64.tar.gz
Download Page: Java SE Development Kit 7 Downloads

Let’s extract the downloaded content and put it in the right place.

tar -xvf jdk-7u51-linux-x64.tar.gz
mkdir -p /usr/lib/jvm
mv ./jdk1.7.0_51/ /usr/lib/jvm/jdk1.7.0_51/

Let’s create some symbolic links:

sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.7.0_51/bin/java” 1
sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.7.0_51/bin/javac” 1
sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.7.0_51/bin/javaws” 1


Let’s ensure right users have the right permission:

sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0

i: 755 provides only read and execute rights to non-owner.