MySQL is one of the most popular open source relational database management system (RDBMS). MySQL has got its name from its co-founder Michael Widenius daughter “My” and “SQL” as Structured Query Language. It is most used in web based software applications. MySQL is also used by many high profile and large scale websites such as Google, Facebook, Twitter and YouTube.
Step 1. Install mysql-server in your Machine by running bellow command from your terminal.
# apt-get install mysql-server -y
Step 2. Specify New password for Mysql root user.
Note: Confirm Password for Mysql root user.
Step 3. Log into your mysql server.
# mysql -u root -p
Step 4. Create New Database named Employee.
mysql> CREATE DATABASE Employee; mysql> use Employee;
Step 5. Create New table for Employee database.
mysql> create table Info (EmpId INT, First_Name VARCHAR(20),Last_Name VARCHAR(20),Address VARCHAR(20),City VARCHAR(15), Department VARCHAR(10),Salary INT);
Step 6. Insert Values in Info Table.
mysql> insert into Info values ( "1" , "Tom" , "Parker" , "WestStreet" , "Las Vegas" , "Accounts" , 1000 );
Step 7. Create New User for Mysql named Harry.
mysql> CREATE USER 'Harry'@'localhost' IDENTIFIED BY 'Password'; mysql> GRANT ALL PRIVILEGES ON * . * TO 'Harry'@'localhost'; mysql> FLUSH PRIVILEGES;
Note: Please Replace Above User and password with your mysql User and Password.