Databases

Install MySQL

MySQL installed directly on your machine, running in the background and secured.

  1. Install MySQL
    Terminal
    brew install mysql
  2. Start it now and on every login
    Terminal
    brew services start mysql
  3. Set a root password and remove test data
    Terminal
    mysql_secure_installation

    Answer the questions. Yes to everything is a good default.

Check it worked

  1. Log in
    Terminal
    mysql -u root -p -e "SELECT VERSION();"
Undo it
  1. Stop and uninstall
    Terminal
    brew services stop mysql && brew uninstall mysql
  1. Install MySQLNeeds sudo
    Terminal · Ubuntu / Debian
    sudo apt install -y mysql-server
  2. Start it now and on every bootNeeds sudo
    Terminal · Ubuntu / Debian
    sudo systemctl enable --now mysql
  3. Remove test data and lock things downNeeds sudo
    Terminal · Ubuntu / Debian
    sudo mysql_secure_installation

    On Ubuntu, root logs in through sudo rather than a password.

Check it worked

  1. Log in
    Terminal · Ubuntu / Debian
    sudo mysql -e "SELECT VERSION();"
Undo it
  1. Uninstall MySQLNeeds sudo
    Terminal · Ubuntu / Debian
    sudo apt remove -y mysql-server
  1. Install MySQL
    PowerShell
    winget install Oracle.MySQL

    The setup window asks you to set a root password. Keep it somewhere safe.

Check it worked

  1. Log in
    PowerShell
    mysql -u root -p -e "SELECT VERSION();"

    If mysql isn't found, open "MySQL Command Line Client" from the Start menu instead.

Undo it
  1. Uninstall MySQL
    PowerShell
    winget uninstall Oracle.MySQL