HOWTO: Setup MySQL and JDBC for java to database programming
Remember to do all this as root! Meaning use sudo before every command or sudo su once before starting this guide.
1) First install mysql using the package manager of your choice.
equo install mysql jdbc-mysql dev-java/sun-jdk
Now that we have the packages installed, the JDK needs mysql-jdbc.jar in the extensions folder to recoginize its installation so
cp /usr/share/jdbc-mysql/lib/mysql-jdbc.jar /opt/sun-jdk-184.108.40.206/jre/lib/ext/
2) Then prepare the mysql database for use and start the mysql process. Run the following commands to prepare the database.
/usr/bin/mysql_install_db; /etc/init.d/mysql start
NOTE: some people have reported problems with mysql acting funny when these commands are ran. If you experience issues. Try
then try step 2 again to see if it works.
3) Also prepare root for use by giving the administrator (root) a password using the following command.
mysqladmin -u root password 'new-password'
4) (optional) If you want MySQL to start automatically everytime you bootup or turn on your computer then run
rc-update add mysql
If you don't mind starting the mysql server manually whenever you want to use it run (as root or superuser)
and login using a terminal like usual (not in root terminal)
mysql -u root -p
Now download a java IDE to develop your java application. One preference is Netbeans. Its free and created by the people who developed java in the first place. I believe this is the best choice. You are welcome to use whatever you prefer, but this how to will use netbeans-6.8 ;)
go to  and download the latest version of netbeans. Make sure you pick the java version, or the ALL version. Netbeans is an IDE for more than Java, but an IDE for Java SE, Java FX, (basically all of java), C++, PHP, and Ruby.
now right click the netbeans.sh file you downloaded and click properties, then click Permissions, and check box "is executable" OR if you are using something other than KDE, type in root terminal
chmod +X /Downloads/netbeans-6.8-ml-java-linux.sh
Now that it is executable in a user terminal (non-root as root cannot access X sometimes) type
cd ~/Downloads/ sudo ./netbeans-6.8-ml-java-linux.sh
It should start an installation window. click customize and uncheck any checkboxes under "Runtimes". You really don't need these unless you know what you are using them for. Select OK, agree to license, and now you should see "Netbeans IDE installation folder" It will want to install in "/usr/local/netbeans-6.8" For simple reasons its not in the package manager we want to seperate it from the rest of the system so we can have a clean uninstall when you wish to remove it later or upgrade. So change that to "/opt/netbeans-6.8" and click install.
If you would like some code to look at to get a feel or an idea on how to write some java jdbc code. I would be happy to send you some code I wrote while in my database class in college. Just email me 
Now you have netbeans, jdbc, and mysql installed! Happy coding!