sudo apt update
sudo apt install mysql-server -ysudo mysql_secure_installationYou can skip this or configure:
- Press
Enterto skip root password setup (or set if prompted) - Remove anonymous users → Yes
- Disallow remote root login → No
- Remove test DB → Yes
- Reload privilege tables → Yes
sudo mysqlThen inside the MySQL shell, run:
-- Create user 'siva' with password
CREATE USER 'siva'@'%' IDENTIFIED BY 'YOUR_OWN_PASSWORD';
-- Grant all permissions
GRANT ALL PRIVILEGES ON *.* TO 'siva'@'%' WITH GRANT OPTION;
-- Save changes
FLUSH PRIVILEGES;
-- Exit MySQL
EXIT;Edit the MySQL config:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnfLook for:
bind-address = 127.0.0.1
Change it to:
bind-address = 0.0.0.0
Save and exit: Ctrl+O, Enter, Ctrl+X
sudo systemctl restart mysqlOpen port 3306 to all IPs (0.0.0.0/0) in:
- GCP → VPC Network → Firewall rules
- AWS → Security Groups
- Azure → NSG (Network Security Groups)
From your local or any remote machine:
mysql -u siva -p -h <your-server-ip>
# Enter password: YOUR_OWN_PASSWORDmysql -u siva -p -h <your-server-ip>CREATE DATABASE i27academy;USE i27academy;CREATE TABLE students (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
course VARCHAR(100)
);INSERT INTO students (name, email, course)
VALUES
('John Doe', 'john@example.com', 'DevOps'),
('Sita Rani', 'sita@example.com', 'GCP'),
('Ravi Kumar', 'ravi@example.com', 'Terraform');SELECT * FROM students;Expected Output:
+----+------------+------------------+------------+
| id | name | email | course |
+----+------------+------------------+------------+
| 1 | John Doe | john@example.com | DevOps |
| 2 | Sita Rani | sita@example.com | GCP |
| 3 | Ravi Kumar | ravi@example.com | Terraform |
+----+------------+------------------+------------+
- The below records will be useful to test read and write transcations after dms is completed
INSERT INTO students (name, email, course)
VALUES
('Amit Sharma', 'amit.sharma@example.com', 'Docker & Kubernetes'),
('Priya Nair', 'priya.nair@example.com', 'Cloud Security'),
('Rahul Verma', 'rahul.verma@example.com', 'Azure DevOps'),
('Neha Singh', 'neha.singh@example.com', 'Python for Automation'),
('Karthik Reddy', 'karthik.reddy@example.com', 'Linux Fundamentals');