10: Getting started with MySQL database beginner tutorial

All Java developers not only must know “SQL”, but also a database is required for “JDBC tutorials”, “Hibernate Tutorials”, and so on. Any decent Java application will require a database. So, your self-taught Java projects must perform CRUD (i.e. Create Read, Update and Delete) operations on the database.

Step 1: Download “MySQL” Zip archive (i.e. Windows (x86, 64-bit), ZIP Archive) from


and select “No thanks, just start my download” when prompted to “login or signup”, and extract the zip file into “c:\tools” folder.

Step 2: Now you have “C:\tools\mysql-5.7.18-winx64”. Add the MySQL to the windows path with “C:\scripts\environment-setup.cmd“, and run it from a DOS console.

Step 3: Initialize the database.

Note down the temporary password: 2017-06-28T10:59:35.902725Z 1 [Note] A temporary password is generated for root@localhost: yw0+k4e-rjlI.

If you make a mistake somewhere, DELETE the entire “C:\tools\mysql-5.7.18-winx64” directory, and REPEAT the steps from unzipping into “c:\tools”.

Start the server – runs on port 3306

MySQL is a client/server application

Step 4: Start the server.

Start the client, change the root password & create a new user

Step 5: Open another dos console, and run the “C:\scripts\environment-setup.cmd”, and start the client as a “root” user

You will be prompted for the password. Enter the one you previously noted down.

Step 6: Change password for ‘root’@’localhost’ with something that you can remember.

Step 7: The superuser “root” is privileged, which means for database administration and is not
running DDLs and DMLs. So, let’s create a new user “user123” with a password “pwd123”

Step 8: Grant permissions to “user123”

Create a new database “learnjavadb” and a table “account”

Step 9: Create a new database named “learnjavadb“.

Step 10: Display the databases.

Step 11: Create a new table named “account“.

Step 12: Describe the table.

Step 13: Insert 3 rows.

Step 14: Select all the rows from the table “Account”.

Step 14: Quit the client.

Backup the database with the “mysqldump” utility program

Step 15: Backup the database.

Step 16: Restore the database.

You can now practice your SQL commands.

Don't be overwhelmed by the number of Q&As & tech stacks as nobody knows everything, and often key Q&As at the right moment makes a difference.

500+ Java Interview FAQs

Java & Big Data Tutorials