Table of Contents
Table of Contents
Before learning about MySQL, it’s important to understand what an RDBMS is. RDBMS stands for Relational Database Management System. It’s a system that organizes data into tables, where each table is made up of rows and columns. These tables are connected through relationships, which show how the data in different tables is related to each other. This makes it easier to see and manage the connections between different pieces of information.
You should know that MySQL is an open source relational database management system used for data administration and storage. Structured query language (SQL) is the foundation of this relational database management system (RDBMS), which was created by Oracle.
The MySQL database operating on a Linux server is covered in this tutorial. The creation and operation of a basic database will also be covered in this lesson. The standard SQL (Standard Query Language) interface language of the MySQL database enables inserts, changes, and queries of data stored in relational tables.
Database management also uses the SQL language to create and change tables, users, and access privileges. Tables contain data in a row-and-column (record) format and are distinguished by their distinct titles. A table with a variable number of rows has a fixed number of named columns declared.
MySQL is a popular choice for managing relational databases for several key reasons are given below.
Step 1: Update Your System
Before installing MySQL, make sure your system is up to date. To do this, run the following commands
sudo apt update
The list of available packages and their versions is updated by this command.
Step 2: Install MySQL
Now, you can install MySQL by running the command
sudo apt install mysql-server
The MySQL server is installed on your machine with this command. Your password will need to be entered. After typing it, hit ENTER. Press Y and then ENTER when prompted to begin the installation.
After the installation is complete, you can check if MySQL was installed correctly and see which version was installed. Run the command mysql –version in your terminal.
mysql --version
Create a first database
create a database named testdb .
sudo mysql -u root
Let’s create a database using the following command:
CREATE DATABASE testdb;
To see the database created use the following command:
show databases;
Create a new database user with permissions
Create the user dbuser in this example with the following command:
CREATE USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘PASSWORD’;
To grant the user database access:
GRANT ALL ON testdb.* To ‘dbuser’@’localhost’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
Quit
You can utilize your database server to interact with any kind of application or service after you’ve installed a database.
Some of The Most Important SQL Commands
● SELECT – extracts data from a database
● UPDATE – updates data in a database
● DELETE – deletes data from a database
● CREATE DATABASE – creates a new database
● ALTER DATABASE – modifies a database
● CREATE TABLE – creates a new table
● ALTER TABLE – modifies a table
● DROP TABLE – deletes a table
● CREATE INDEX – create an index
● DROP INDEX – deletes an index
MySQL is a strong and flexible open-source database system. Its reliability, ability to grow with your needs, fast performance, and compatibility with many tools make it popular in many industries, including e-commerce, healthcare, and social media.
Thanks to its solid security features and broad support, MySQL continues to be a key tool for effectively managing and handling data today.
Visit Flexicloud to discover more about our comprehensive plans and diverse features, designed to meet all your cloud computing needs