Nov 04
Normally when I build a web application that connects to a MySQL database, I would place the mysql-connector-java-bin.jar file into the WEB-INF/lib of the web application.
However, when I deployed the application on Tomcat 5.5 on Ubuntu 8.04 I got an exception: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
I couldn’t find the reason which caused the exception, so I did a quick fix by placing the jar file into the Tomcat’s common lib directory.
$ cp mysql-connector-java-bin.jar /usr/share/java
$ cd /usr/share/tomcat5.5/common/lib
$ ln -s ../../../java/mysql-connector-java-bin.jar mysql-connector-java-bin.jar
May 15
Installing MySQL for Ubuntu
From the Ubuntu desktop:
- Go to System > Administration > Synapatic Package Manager
- Search for “mysql-server” and “Mark for installation”
- Click on the “Apply” to install
From the command line:
$ sudo apt-get install mysql-server
Setting a Password for the MySQL Root User
By default the MySQL installation doesn’t have the password set for root. To set the password at the unix prompt:
$ mysqladmin -u root password <password>
Creating a Database in MySQL
Login into MySQL as root and in the prompt type:
mysql> CREATE DATABASE <database name>
Granting Privileges in MySQL
In the MySQL prompt:
mysql> GRANT <what to grant> ON <database name>.* TO '<username>'@'<hostname>' IDENTIFIED BY '<password>'
Backing Up Your Database
Use the mysqldump command line:
$ mysqldump <database name>
To backup more than one database:
$ mysqldump --databases <database 1> <database 2>
To backup all the databases:
$ mysqldump --all-databases
Restoring Your Database
$ mysql -u <username> -p <database name> < <database backup file>