Launch your tech mastery with us—your coding journey starts now!
Course Content
Introduction to MySQL
0/1
Installation and Setup of MySQL
0/1
MySQLData Types
0/1
MySQL Table Operations
0/1
MySQL Indexes and Keys
0/1
MySQL Views
0/1
MySQL Transactions
0/1
User Management and Security in MySQL
0/1
Backup and Restore in MySQL
0/1
MySQL

Setting up MySQL is the first step toward working with relational databases. Below is a complete guide to help you install and run MySQL on your system, whether you are using Windows, Linux, or macOS. The second step is to start and stop MySQL service on your system. This ensures the MySQL server is running and ready to accept connections and execute queries.

Below is a complete guide covering both steps — installation and managing the MySQL service — for all major platforms.

Step 1: Installing MySQL

  1. On Windows:
  1. Go to the official MySQL download page:
    👉 https://dev.mysql.com/downloads/installer

  2. Download the MySQL Installer for Windows (either web or full version).
  3. Run the installer and select the setup type:
    • Developer Default (recommended for most users)
    • Server Only
    • Custom
  4. Follow the setup wizard to:
    • Install MySQL Server and MySQL Workbench
    • Set a root password
    • Configure MySQL as a Windows service

  5. Finish the installation and test it using MySQL Workbench or Command Line.
  1. On Linux (Ubuntu/Debian):

sudo apt update

sudo apt install mysql-server

sudo systemctl start mysql

sudo systemctl enable mysql

You can secure the installation with:  sudo mysql_secure_installation

  1. On macOS (Using Homebrew):
  2. Make sure Homebrew is installed. Then run:
    brew update

brew install mysql

  1. Set root password:

mysql_secure_installation

Step 2: Starting and Stopping MySQL Service

Once installed, you’ll often need to start or stop the MySQL service.

  1. On Windows:

To start or stop MySQL service:

net start mysql

net stop mysql

 Run in: Command Prompt (Start > cmd) or PowerShell

  1. On Linux:

sudo systemctl start mysql

sudo systemctl stop mysql

sudo systemctl status mysql

Run in: Terminal

  1. On macOS:

brew services start mysql

brew services stop mysql

Run in: Terminal