Tuesday, February 24, 2015

Create a MySQL Database - Part1

MySQL is a free and open source database management system. To create a database and set up tables for the same use the following sql commands.


  1. CREATE DATABASE – create the database. To use this statement, you need the CREATE privilege for the database.
  2. CREATE TABLE – create the table. You must have the CREATE privilege for the table.
  3. INSERT – To add/insert data to table i.e. inserts new rows into an existing table.



Login as the mysql root user to create database:

mysql -u root -p



Create Database book

CREATE DATABASE books;




Select / Use Database for further operations

USE books;



Create a sample table in a database

CREATE TABLE authors (id INT, name VARCHAR(20), email VARCHAR(20));



Check the table definition

SHOW TABLES;



Insert record in author table

INSERT INTO authors (id,name,email) VALUES(1,"Jig","xuz@abc.com");

INSERT INTO authors (id,name,email) VALUES(2,"Mak","m@gmail.com");

INSERT INTO authors (id,name,email) VALUES(3,"Hari","Hari@yahoo.com");



Select records from that table.

SELECT * FROM authors;

apt-key warning when sudo apt update run

Issue: apt-key warning when sudo apt update run Update below file: cat /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list ...