• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How To Install Mysql And Create Database,Tables,Dump and Restore Mysql On Linux Mint 20.2

  • 00:42 lsb_release -a
  • 01:00 apt install mysql-server mysql-client -y
  • 01:20 mysql_secure_installation
  • 02:09 mysql -u root -p
  • 02:26 show databases;
  • 02:46 create database linuxhelp;
  • 03:13 use linuxhelp;
  • 03:55 create table employe(empno int,name varchar(20),salary int);
  • 04:31 insert into employe values(101,'alex',10000);
  • 06:01 select*from employe;
  • 06:22 show databases;
  • 06:47 show tables;
  • 07:02 quit
  • 07:42 mysqldump -u root -p linuxhelp > linuxhelbkp.sql
  • 07:50 ls
  • 08:18 mysql -u root -p
  • 08:41 drop database linuxhelp;
  • 08:49 show databases;
  • 09:19 create database linuxhelp;
  • 09:26 quit;
  • 10:06 mysql -u root -p -h localhost linuxhelp < linuxhelbkp.sql
  • 10:16 mysql -u root -p
  • 10:28 show databases;
  • 10:36 use linuxhelp;
  • 10:47 show tables;
{{postValue.id}}

To Install Mysql And Create Database,Tables,Dump and Restore Mysql On Linux Mint 20.2

Introduction :

In a corporate network, databases can be anything from simple shopping lists to picture galleries. A relational database is a digital store that collects and organizes data according to a relationship model. A table in this model consists of rows and columns, and all relationships between elements follow a logical structure.

Installation Procedure:

Step 1 : Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Linuxmint
Description:	Linux Mint 20.2
Release:	20.2
Codename:	uma

Step 2 : Install the mysql-server packages by using the below command

root@linuxhelp:~# apt install mysql-server mysql-client -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mysql-client mysql-server
0 upgraded, 2 newly installed, 0 to remove and 16 not upgraded.
Need to get 19.0 kB of archives.
After this operation, 225 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-client all 8.0.27-0ubuntu0.20.04.1 [9,424 B]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-server all 8.0.27-0ubuntu0.20.04.1 [9,548 B]
Unpacking mysql-server (8.0.27-0ubuntu0.20.04.1) ...
Setting up mysql-server (8.0.27-0ubuntu0.20.04.1) ...
Setting up mysql-client (8.0.27-0ubuntu0.20.04.1) ...

Step 3 : To see the secure installation process by using the below command

root@linuxhelp:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 25 
Success.

All done! 

Step 4 : Enter into the mysql shell by using the below command

root@linuxhelp:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 5 : List the database by using the below command

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

Step 6 : Create the database in the name of linuxhelp by using the below command

mysql> create database linuxhelp;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| linuxhelp          |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

Step 7: To Get into the linuxhelp database by using the below command

mysql> use linuxhelp;
Database changed

Step 8 : Create the table in the name of employe by using the below command

mysql> create table employe(empno int,name varchar(20),salary int);
Query OK, 0 rows affected (0.02 sec)

Step 9 : Insert the values inside the Tables by using the below commands.

mysql> insert into employe values(101,'alex',10000);
Query OK, 1 row affected (0.01 sec)
mysql> insert into employe values(102,'richard',15000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employe values(103,'michel',20000);
Query OK, 1 row affected (0.00 sec)

Step 10 : To list inside the table’s creation by using the below command.

mysql> select*from employe;
+-------+---------+--------+
| empno | name    | salary |
+-------+---------+--------+
|   101 | alex    |  10000 |
|   102 | richard |  15000 |
|   103 | michel  |  20000 |
+-------+---------+--------+
3 rows in set (0.00 sec)

Step 11 : To List the databases by using the below command

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| linuxhelp          |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> use linuxhelp;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

Step 12 : To List the tables by using the below commands

mysql> show tables;
+---------------------+
| Tables_in_linuxhelp |
+---------------------+
| employe             |
+---------------------+
1 row in set (0.00 sec)

Step 13 : Quit the mysql shell by using the below command.

mysql> quit
Bye

Step 14 : Dump the linuxhelp by using the below command

root@linuxhelp:~# mysqldump -u root -p linuxhelp > linuxhelbkp.sql
Enter password: 

Step 15 : To List the root directory by using the below command

root@linuxhelp:~# ls
linuxhelbkp.sql

Step 16 : Enter into the mysql shell by using the below command

root@linuxhelp:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 17 : Delete the database by using the below drop command

mysql> drop database linuxhelp;
Query OK, 1 row affected (0.03 sec)

Step 18 : Check the databases whether it is deleted or not.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

Step 19 : After deleting the database. Create the new database with the same name.

mysql> create database linuxhelp;
Query OK, 1 row affected (0.01 sec)
Step 20 : Quit the mysql shell by using the below command
mysql> quit;
Bye

Step 21 : Restore the database by using the below command

root@linuxhelp:~# mysql -u root -p -h localhost linuxhelp < linuxhelbkp.sql 
Enter password: 

Step 22 : Enter into the mysql Shell by using the below command

root@linuxhelp:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 23 : List the databases by using the below command

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| linuxhelp          |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

Step 24 : To Get into the linuxhelp and check the table is restored or not use the below command

mysql> use linuxhelp;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed

Step 25 : Here we can see the table in the linuxhelp database is restored without any data lose

mysql> show tables;
+---------------------+
| Tables_in_linuxhelp |
+---------------------+
| employe             |
+---------------------+
1 row in set (0.00 sec)

With this the process of creating the database, Tables ,Dump and restore in mysql on Linux mint 20.2 has comes to an end.

Tags:
sebastian
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to create a database in mysql?

A

To create a database by using create database linuxhelp command.

Q

How can we get into the database?

A

To get into the database by using use linuxhelp command.

Q

How to create a Table in mysql?

A

To create a tablle in mysql by using create table employe(empno int,name varchar(20),salary int) command.

Q

How can We insert the values inside the tables?

A

To insert the value inside the tables by using insert into employe values(101,'alex',10000); command.

Q

How do we Dump and restore?

A

By using the mysqldump -u root -p linuxhelp > linuxhelbkp.sql to dump the database and then mysql -u root -p -h localhost linuxhelp < linuxhelbkp.sql for restoring the databases.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.