0% found this document useful (0 votes)
16 views

Task 1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Task 1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Task 1.

2 MariaDB

install mariadb version 10.6 and do the following Tune the mysql using MySQLTuner script Enable query
log Enable slow query log Create database named "Mohamed" Create table name “ axispay” Insert
dummy data

1. Install MariaDB 10.6

Add MariaDB Repository and Install

1. Update the package list:

sudo apt update

2. Install required packages:

sudo apt install software-properties-common dirmngr

3. Add the MariaDB signing key:

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

4. Add the MariaDB repository:

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el]


https://mirrors.xtom.com/mariadb/repo/10.6/ubuntu focal main'

5. Update the package list again:

sudo apt update

6. Install MariaDB server:

sudo apt install mariadb-server

7. Start and enable the MariaDB service:

sudo systemctl start mariadb

sudo systemctl enable mariadb

2. Secure MariaDB Installation

Run the security script to set the root password and secure the installation:

sudo mysql_secure_installation
Follow the prompts to set the root password, remove anonymous users, disable remote root login,
remove the test database, and reload privilege tables.

MySQLTuner is a Perl script designed to assist with the tuning of MySQL and MariaDB servers. It connects
to a running MySQL server, analyzes its performance, and provides recommendations for configuration
improvements.

3. Tune MySQL Using MySQLTuner Script

1. Download MySQLTuner:

wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl

2. Make the script executable:

chmod +x mysqltuner.pl

3. Run MySQLTuner:

sudo ./mysqltuner.pl

MySQLTuner will analyze your MariaDB configuration and suggest optimizations. Review and apply the
suggestions as needed.

4. Enable Query Log

1. Edit the MariaDB configuration file:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

2. Add or modify the following lines:

general_log_file = /var/log/mysql/query.log

general_log =1

This enables the general query log, which logs all queries executed by MariaDB.

3. Restart MariaDB:

sudo systemctl restart mariadb

5. Enable Slow Query Log

1. Edit the MariaDB configuration file again:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

2. Add or modify the following lines:

slow_query_log = 1

slow_query_log_file = /var/log/mysql/slow.log

long_query_time = 1
This enables the slow query log, which logs queries that take longer than 1 second to execute.

3. Restart MariaDB:

sudo systemctl restart mariadb

6. Create Database and Table

1. Access the MariaDB shell:

sudo mysql -u root -p

2. Create a database named "Mohamed":

CREATE DATABASE Mohamed;

3. Use the newly created database:

USE Mohamed;

4. Create a table named axispay:

CREATE TABLE axispay (

id INT AUTO_INCREMENT PRIMARY KEY,

name VARCHAR(255) NOT NULL,

amount DECIMAL(10, 2) NOT NULL

);

7. Insert Dummy Data

1. Insert dummy data into the axispay table:

INSERT INTO axispay (name, amount) VALUES ('John Doe', 1000.00), ('Jane Smith', 2000.00);

2. Verify the data:

SELECT * FROM axispay;

This completes the installation and configuration of MariaDB 10.6, including creating the "Mohamed"
database and "axispay" table, along with inserting dummy data. Let me know if you need further
assistance!

You might also like