How to create your own database on Linux?

Using a MySQL database allows you to create, edit, and delete information, such as data tables, that will be stored in it. In this article, we will discuss how to create your own database.

What is Linux?

Linux is the general name for UNIX-like operating systems based on a free kernel (Kernel is the program that defines the operation of any operating system and ensures the interaction of hardware and software) Linux and the libraries and system programs built for it, developed within the project GNU.

Linux, unlike most other OSes, does not have a specific “official” bundle. It comes in a large number of distributions that link GNU programs to the Linux kernel.

In Windows, you are used to seeing logical drives C, D, and so on, in Linux, there are no such drives. Instead, Linux has a root (/) from which everything grows. All file and directory addresses start exactly from the root, all partitions are mounted at the root, including physical disks (USB flash drives, and so on). Thus, absolutely all physical disks and partitions are combined into a single file structure starting with the root (/).

The following types of file systems are actively used in Linux:

  • ext4 is a modern journaling filesystem that is standard on Linux;
  • btrfs is a fairly new file system based on B-tree structures, in some tests it shows even better performance compared to ext4;
  • xfs – this file system is distinguished by a fairly high performance in terms of writing and reading data. However, there is a risk of data loss in the event of serious failures.

How to create your own database?

For a long time, I carried out all the basic operations with MySQL databases in the web interface – through the usual hosting panel and the PhpMyAdmin utility. In this format, all database administration fell on the shoulders of the PhpMyAdmin application, which is written in PHP and depends on various factors, such as the configuration of the webserver, software versions, and PHP itself. When the number of databases grows, and environments are constantly changing, MyPhpAdmin requires additional resources and settings, otherwise, it may not work very stable, for example, errors, limits, and timeouts are triggered. And the web interface itself has its own limitations, so professionals use only the command line for serious tasks.

MySQL is the most popular open-source relational database management system. This tutorial explains how to create MySQL or MariaDB databases using the command line. In the process of working with MySQL, it becomes necessary to create a new database and a user on whose behalf queries will be made to this database, as well as the assignment of access rights to certain data of this database.

To create a database, the following actions should be done:

  • Go to the MySQL download page, and select the appropriate platform to download the latest MySQL server.
  • After MySQL is installed, connect to it as root user and create the database. After connecting as MySQL root user, run the following command “mysql>” to create the database.
  • Connect to the newly created database with the “use” command before performing any operation on the database.

Installing the database on Ubuntu is quickest with the apt (Advanced Packaging Tool) Application Installation Manager. And the main advantage of the manager is that it does not require a separate installation, since it is included in the standard software package. Apt allows you to install an application on a server without unnecessary commands, which can be subsequently accessed by all users of a specific network group that you give access to.