Monday, June 9, 2025

Install MySQL on Ubuntu using terminal (Jun 2025)

To See All Articles About Technology: Index of Lessons in Technology

Here’s how to install MySQL on Ubuntu using the terminal — works for Ubuntu 20.04, 22.04, and newer.


✅ Step-by-Step: Install MySQL on Ubuntu

1. Update package index

bash
sudo apt update

2. Install MySQL Server

bash
sudo apt install mysql-server -y

3. Start MySQL Service

bash
sudo systemctl start mysql

4. Enable MySQL to start on boot

bash
sudo systemctl enable mysql

5. Secure the installation (optional but recommended)

bash
sudo mysql_secure_installation
  • Set a root password

  • Remove anonymous users

  • Disallow remote root login

  • Remove test database

  • Reload privilege tables

6. Verify MySQL is Running

bash
sudo systemctl status mysql

7. Log in to MySQL

bash
sudo mysql -u root -p

📦 Optional: Install MySQL Workbench (GUI)

bash
sudo apt install mysql-workbench

Let me know if you want to:

  • Create a new database and user

  • Connect MySQL with Python (using mysql-connector-python)

  • Allow remote connections or configure firewall settings

I'm here to help.

Tags: Technology,Database,

No comments:

Post a Comment