First you need to install MySQL in ubuntu.For that ,run below command into your terminal.
sudo apt-get install mysql-server
After some moment system will ask for your database password.
Enter a password and remember it because it will need in future for access your database.
After that run below command and enter your user password:
mysql -u root -p
Now,it’s time to install mysql-workbench.
Run below command to install.
sudo apt-get install mysql-wokbench
Now from your dashboard search for “MySQL” and open it….
Click on Database and then connect Database.After that it will ask for your database password which you entered during installation.
Now create a new Schema.I created a schema with the name “Database”….
After that create a table.You can find that option under Database.See below screen shot for further help.
Now it’s time to insert data.You can do that manually or import data from a file.
For import data from file right click on employee and click on “Select data import wizard”. After that select your file.
Now put mysql-connector.jar file in below location.
Download link: mysql-connector.jar
Create a Main.java file like that and run your java code.
You will get output from your database…..!!