← Back to MySQL Course | Chapter 1: Introduction & Basics | Lesson 4 of 8

MySQL Installation & Setup

Installing MySQL is like setting up a new storage room: you pick the version that fits your computer and follow the steps to open it for business.

Preparing for Installation

Before installing, confirm you're downloading the correct MySQL build for your operating system and CPU architecture, since mixing an incompatible installer with your OS is the most common source of setup failures. Free up a few hundred megabytes of disk space beforehand too.

Example: Preparing for Installation

sql
-- Confirm the installer matches your OS and CPU architecture before running it

Choosing the Right Edition

MySQL Community Edition is the free, fully-featured version most developers and small teams use, while Enterprise Edition adds paid extras like advanced auditing, backup tooling, and official support contracts aimed at large organizations with compliance requirements.

Example: Choosing the Right Edition

sql
-- MySQL Community Edition (free) vs Enterprise Edition (paid, extra tooling)

Verifying the Installation

After installing, connect with a client (the command line, Workbench, or a code library) and run a trivial query like SELECT 1 to confirm the server actually responds — a clean install can still fail to start if a port conflict or permissions issue exists.

Example: Verifying the Installation

sql
SELECT 1;

Initial Server Configuration

The installer lets you pick the default storage engine (almost always InnoDB today, for its transaction and foreign-key support) and the server's timezone setting, which affects how TIMESTAMP columns are interpreted and displayed later.

Example: Initial Server Configuration

sql
CREATE TABLE test (id INT) ENGINE=InnoDB;
SET time_zone = '+00:00';

Securing the Installation

Security hardening during setup mainly means setting a strong root password and, ideally, running the mysql_secure_installation script to remove default test databases and anonymous-user accounts that ship enabled by default.

Example: Securing the Installation

sql
-- Run mysql_secure_installation after setup to remove test databases and anonymous users
ALTER USER 'root'@'localhost' IDENTIFIED BY 'StrongPassword!23';
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Downloading the wrong build for your operating system or CPU, so the installer will not run or the server will not start.
  2. Forgetting the root password chosen during setup, and then being unable to log in.
  3. Typing mysql in a terminal that cannot find it because the install folder is not in the PATH.
🔒

Chapter Quiz — Complete all 8 topics to unlock

0/8 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.