How to Install MariaDB in Ubuntu 24.04 LTS and Access from Remote server
inchirags@gmail.com MariaDB DBA Tutorial www.chirags.in/ *****************************************************************************************
* How to Install MariaDB in Ubuntu 24.04 LTS and Access from remote server *
*****************************************************************************************
Here’s a step-by-step guide to install MariaDB on Ubuntu 24.04 LTS:
Enter the root password you set during the secure installation.
Step 7: Create a Database and User (Optional)
Create a test database and user for verification.
CREATE DATABASE testdb;
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
-- Create user & database and access from remote server
CREATE DATABASE testdb2;
CREATE USER 'testuser2'@'192.168.224.130' IDENTIFIED BY 'admin@123';
GRANT ALL PRIVILEGES ON testdb2.* TO 'testuser2'@'192.168.224.130';
FLUSH PRIVILEGES;
EXIT;
Step 8: Allow Remote Access (Optional)
If you want to allow remote connections:
Edit the MariaDB configuration file:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Find the line starting with bind-address and change it to:
bind-address = 0.0.0.0
Restart MariaDB:
sudo systemctl restart mariadb
Step 9: Verify MariaDB Installation
Log in using your new user:
Chirags Tutorial (Chirags.in)
How to Install MariaDB in Ubuntu 24.04 LTS and Access from Remote server
inchirags@gmail.com MariaDB DBA Tutorial www.chirags.in/
*****************************************************************************************
* How to Install MariaDB in Ubuntu 24.04 LTS and Access from remote server *
*****************************************************************************************
Here’s a step-by-step guide to install MariaDB on Ubuntu 24.04 LTS:
Step 1: Firewall Configuration
sudo ufw status
sudo ufw allow ssh
sudo ufw allow 3306/tcp
sudo ufw enable
Step 2: Update System Packages
First, ensure your system is up to date.
sudo apt update
sudo apt upgrade -y
Step 3: Install MariaDB Server
Install the MariaDB server package.
sudo apt install mariadb-server -y
Verify the installation:
mariadb --version
Step 4: Secure MariaDB Installation
Run the security script to improve the security of your MariaDB installation.
sudo mysql_secure_installation
Set root password? (If not set already, set a strong password)
Remove anonymous users? (Yes)
Disallow root login remotely? (Yes)
Remove test database and access to it? (Yes)
Reload privilege tables now? (Yes)
Step 5: Enable and Start MariaDB Service
Ensure MariaDB is enabled and running.
sudo systemctl enable mariadb
sudo systemctl start mariadb
Check the status:
sudo systemctl status mariadb
Step 6: Log in to MariaDB Shell
Log in as root user:
sudo mysql -u root -p
Enter the root password you set during the secure installation.
Step 7: Create a Database and User (Optional)
Create a test database and user for verification.
CREATE DATABASE testdb;
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
-- Create user & database and access from remote server
CREATE DATABASE testdb2;
CREATE USER 'testuser2'@'192.168.224.130' IDENTIFIED BY 'admin@123';
GRANT ALL PRIVILEGES ON testdb2.* TO 'testuser2'@'192.168.224.130';
FLUSH PRIVILEGES;
EXIT;
Step 8: Allow Remote Access (Optional)
If you want to allow remote connections:
Edit the MariaDB configuration file:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Find the line starting with bind-address and change it to:
bind-address = 0.0.0.0
Restart MariaDB:
sudo systemctl restart mariadb
Step 9: Verify MariaDB Installation
Log in using your new user:
mysql -u testuser -p
-- access from remote server
mysql -h 192.168.224.129 -u testuser -p
Check the databases:
SHOW DATABASES;
Step 10: Enable Automatic Updates (Recommended)
Ensure MariaDB updates automatically:
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure --priority=low unattended-upgrades
Step 11: Backup MariaDB (Optional but Recommended)
Set up a simple backup:
sudo mariadb-dump -u root -p --all-databases > backup.sql
MariaDB is now successfully installed on Ubuntu 24.04 LTS! Let me know if you encounter any issues. 😊
For any doubts and query, please write on YouTube video comments section.
Note : Flow the Process shown in video.
😉Please, Subscribe and like for more videos:
youtube.com/@chiragstutorial
💛Don't forget to, 💘Follow, 💝Like, 💖Share 💙&, Comment
Thanks & Regards,
Chitt Ranjan Mahto "Chirag"
2 months ago (edited) | [YT] | 0
View 0 replies