Are you ready to play with Databases?
Mariadb installation for ubuntu 22.04
For the purpose of installing MariaDB on Ubuntu 22.04, follow the given instructions.
Step 1: Update system packages
sudo apt update
Step 2: Install packages
Execute the below-given command to install packages essential for MariaDB installation:
sudo apt-get install wget software-properties-common dirmngr ca-certificates apt-transport-https -y
Step 3: Install MariaDB
To install MariaDB on Ubuntu 22.04, utilize the given command in the terminal:
sudo apt install mariadb-server mariadb-client
Step 4: Check MariaDB version
Now, check the version of the installed MariaDB:
mariadb --version
Step 5: Check MariaDB status
Then, check if MariaDB is active on your Ubuntu 22.04 system:
sudo systemctl status mariadb
Step 6: Execute MariaDB script for Secure Installation
You will be then asked to configure the following settings:
- Password for root user
- unix-socket authentication
- Test database and its access
- Reloading privileges
sudo mysql_secure_installation
Command Are self Explanotry please Carefully read promt and then press Y for yes and n for not.
Step 7: Log in to MariaDB
sudo mariadb
Step 8: Create User if Required and give permissions
CREATE USER 'abhinav'@'localhost' IDENTIFIED BY 'password';
Below will Drop user if Exist and then Create:
CREATE OR REPLACE USER 'abhinav'@'localhost' IDENTIFIED BY 'password';
Step 9: Grant Privileges [ If Required otherwise provide only Necessary privileges ]
Then grant all privileges to the created MariaDB ‘abhinav’ user:
GRANT ALL PRIVILEGES ON *.* to 'abhinav'@'localhost';
There are other Privilages like:
- SELECT: allows the user to retrieve data from one or more tables in a database.
- INSERT: allows the user to add new rows of data into a table.
- UPDATE: allows the user to modify existing data in one or more rows of a table.
- DELETE: allows the user to remove one or more rows of data from a table.
- CREATE: allows the user to create new databases and tables.
- DROP: allows the user to delete existing databases and tables.
- INDEX: allows the user to create and manage indexes on tables.
- ALTER: allows the user to modify the structure of an existing table.
Thank You