Steps To Install Mysql on Ubuntu and Create Delete Update Database using mysql shell

MySQL is a relational database management system which runs as a server and allows multiple users to manage and create numerous databases.It is used for a wide range of purposes, including web applications, data warehousing, e-commerce, and logging applications. The most common use for mySQL is web database.

Steps to install Mysql on Ubuntu

You will be prompted for root password during the installation. Choose a secure password & complete in installation.

Type following command to check installation

You will prompted for password, Enter root password to continue, then you will get following output. It means your installation is successful.

To Access the MySQL shell

Enter root MySQL password into the prompt. Now you will be able to start building your MySQL database. All MySQL commands end with a semicolon.

Now we can perform all DDL (Data Definition Language) & DML (Data Manipulation Language) operations through Terminal window. Here i assume that you are familiar with basic SQL statements, so I demonstrated basic SQL commands.

To Create Database

You can show databases by following command:

To Access a MySQL Database

Here COLLEGE Database is selected. so we can create use this database to create tables.

To Create a MySQL Table
Here as example create table student having fields ROLL_NUMBER, STUDENT_NAME, COLLEGE_NAME, BRANCH, ADMISSION DATE with proper data type.

To Verify tables in Database

To check properties of tables columns

To Insert Records in the Table

Please write special character correctly before execution.Here columns name is encoded in and values of varchar type is encoded in “”(double quotes).

Once Query get executed correctly, you get message as

Similarly add more records as

To check inserted records or records from table

To Delete a Records

Here we are deleting a records whose name is ‘TOM’. As we know the syntax of delete SQL statement as follows.

Example of deleting a records is given below.

To Update a Record

Here we are modifying the student name whose roll number is 444. so execute sql statement update. Syntax of update SQL statement as follows.

Example of updating record in STUDENT table as follows.

Thanks !
In Next tutorial we will see how to use mysql database to develop web application using Java Servlet.

One Comment

Leave a Reply