• 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 create, drop database and table in MySQL on Debian 11.3

  • 00:30 cat /etc/os-release
  • 00:40 apt install mariadb-server -y
  • 01:01 mysql_secure_installation
  • 01:39 mysql -u root -p
  • 01:56 CREATE DATABASE linuxhelp;
  • 02:08 flush privileges;
  • 02:23 USE linuxhelp;
  • 02:33 CREATE TABLE linuxhelp (id INT, name VARCHAR(20), email VARCHAR(20));
  • 02:50 SHOW TABLES;
  • 03:05 INSERT INTO linuxhelp (id,name,email) VALUES(1,"linux","linux@help.com");
  • 03:40 INSERT INTO linuxhelp (id,name,email) VALUES(3,"Tom","tom@yahoo.com");
  • 04:11 select * from linuxhelp;
  • 04:35 DROP USER'USER1'@'localhost';
{{postValue.id}}

To Create,Drop Database Table In MySQL On Debian 11.3

Introduction:

The MySQL database application is free and open-source. As a popular database solution, it is known for its high performance, ease of use, and data security.In MySQL, creating tables is a fundamental process for storing and organizing data.

Installation Procedure:

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

root@linuxhelp: ~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Step: 2 Install the MariaDB-server by using the below command

root@linuxhelp: ~# apt install mariadb-server -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libonig5
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  mariadb-server
0 upgraded, 1 newly installed, 0 to remove and 95 not upgraded.
Need to get 35.3 kB of archives.
After this operation, 72.7 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 mariadb-server all 1:10.5.15-0+deb11u1 [35.3 kB]
Fetched 35.3 kB in 0s (203 kB/s)          
Selecting previously unselected package mariadb-server.
(Reading database ... 282030 files and directories currently installed.)
Preparing to unpack .../mariadb-server_1%3a10.5.15-0+deb11u1_all.deb ...
Unpacking mariadb-server (1:10.5.15-0+deb11u1) ...
Setting up mariadb-server (1:10.5.15-0+deb11u1) ...

Step 3: Install the MySQL secure installation and set the root passwd

root@linuxhelp: ~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

Step 4: Login into MySQL Database by using the below command

root@linuxhelp: ~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 58
Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Step 5: Create a MySQL Database by using the below command

MariaDB [(none)]> SHOW TABLES;

MariaDB [(none)]> CREATE DATABASE linuxhelp;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> USE linuxhelp;
Database changed

Step 6: Create a Table in Database by using the below command

MariaDB [linuxhelp]> CREATE TABLE linuxhelp (id INT, name VARCHAR(20), email VARCHAR(20));
Query OK, 0 rows affected (0.017 sec)

Step 7: Show the Database by using the below command

MariaDB [linuxhelp]> SHOW TABLES;
+---------------------+
| linuxhelp           |
+---------------------+
1 row in set (0.000 sec)

Step 8: Insert Data from database by using the below command

MariaDB [linuxhelp]> INSERT INTO linuxhelp (id,name,email) VALUES(1,"linux","linux@help.com");
Query OK, 1 row affected (0.026 sec)

MariaDB [linuxhelp]> INSERT INTO linuxhelp (id,name,email) VALUES(3,"Tom","tom@yahoo.com");
Query OK, 1 row affected (0.006 sec)

Step 9: Alter and View Database by using the below command

MariaDB [linuxhelp]> select * from linuxhelp;
+------+--------+---------------+
| id   | name   | email         |
+------+--------+---------------+
|    1 | linux | linux@help.com |
|    3 | Tom    | tom@yahoo.com |
+------+--------+---------------+
2 rows in set (0.008 sec)

Step 10: Drop the MariaDB database by using the below command

MariaDB [MYSQL]> DROP USER'USER1'@'localhost';
Query OK, 0 rows affected (0.001 sec)

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Create, Drop Database and table in MySQL on Debian 11.3. Your feedback is much welcome.

Tags:
adhitiroy
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to create a database in MariaDB?

A

To create the database in MariaDB CREATE DATABASE Database_name;

Q

How to use MariaDB?

A

By using the following commands USE database_name;

Q

How to insert the table in the MariaDB database?

A

To insert the tables by using commands INSERT INTO linuxhelp (id,name,email) VALUES(1,"linux","linux@help.com");

Q

How to create a new Table?
To create a new table in MariaDB
CREATE TABLE linuxhelp (id INT, name VARCHAR(20), email VARCHAR(20));

A

To create a new table in MariaDB
CREATE TABLE linuxhelp (id INT, name VARCHAR(20), email VARCHAR(20));

Q

How to remove the Database in MariaDB?

A

By using the following commands to drop the databases.
DROP database [name]

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 Gibbson ?
How do i run both nginx and apache in same instance on centos

Hi...,

my server is based centos operating system and my webserver is already running on Apache.... i need to run both apache and nginx on same instance ... please help me to implement this concept...

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.