Lewati ke konten
Kembali ke Blog

Cara Install MySQL di Windows 10 dan 11: Panduan Lengkap Server Setup

Β· Β· 5 menit baca

Install MySQL di Windows adalah proses yang straightforward dengan MySQL Installer. Setelah setup MySQL untuk development di banyak Windows machines, saya akan berbagi langkah-langkah yang terstruktur.

Download MySQL Installer

1. Download dari Website Resmi

  1. Buka browser dan kunjungi: https://dev.mysql.com/downloads/installer/
  2. Pilih Windows (x86, 32-bit), MSI Installer
  3. Download mysql-installer-community-8.0.x.msi
  4. Ukuran file sekitar 400-500 MB

2. Pilih Installer Type

Web Community (Recommended):
– Ukuran kecil (~20 MB)
– Download komponen saat install
– Selalu versi terbaru

Full Community:
– Ukuran besar (~400 MB)
– Semua komponen included
– Cocok untuk offline install

Proses Instalasi

1. Jalankan Installer

  1. Right-click file .msi yang didownload
  2. Pilih Run as administrator
  3. Jika muncul Windows SmartScreen, klik More info β†’ Run anyway

2. License Agreement

  1. Pilih I accept the license terms
  2. Klik Next

3. Choosing a Setup Type

Pilih salah satu:

Developer Default (Recommended):
– MySQL Server
– MySQL Workbench (GUI)
– MySQL Shell
– MySQL Router
– MySQL Connectors

Server Only:
– Hanya MySQL Server
– Cocok untuk server production

Full:
– Semua komponen
– Memerlukan space lebih besar

Custom:
– Pilih komponen specific
– Untuk advanced users

4. Check Requirements

Installer akan cek prerequisites:
Microsoft Visual C++ Redistributable
.NET Framework

Jika ada yang missing:
1. Klik Execute untuk install otomatis
2. Atau download manual dari Microsoft
3. Restart komputer jika diminta
4. Jalankan ulang MySQL Installer

5. Installation

  1. Klik Execute untuk mulai instalasi
  2. Tunggu proses download dan install (10-30 menit)
  3. Progress bar akan menunjukkan status
  4. Klik Next setelah selesai

Konfigurasi MySQL Server

1. Configuration Type

Standalone MySQL Server / Classic MySQL Replication:
– Pilihan ini untuk single server
– Cocok untuk development dan small production

Sandbox InnoDB Cluster Test Setup:
– Untuk testing cluster
– Advanced users only

2. Authentication Method

Use Strong Password Encryption for Authentication (RECOMMENDED):
caching_sha2_password (default MySQL 8.0)
– Lebih secure
– Requre MySQL 8.0+ connectors

Use Legacy Authentication Method:
mysql_native_password
– Backward compatible
– Cocok untuk legacy applications

3. Root Account Password

  1. Masukkan MySQL Root Password
  2. Ketik ulang di Repeat Password
  3. REKOMENDASI: Gunakan password kuat!
    – Minimal 12 karakter
    – Kombinasi huruf, angka, simbol
    – Contoh: MySQL@Secure2024!

4. Windows Service

Configure MySQL Server as a Windows Service:
– βœ… Check untuk enable
Service Name: MySQL80 (atau MySQL81)
Start the MySQL Server at System Startup:
– βœ… Check untuk auto-start
– Uncheck jika ingin manual start

Run Windows Service as:
Standard System Account (recommended)
– Atau Custom User jika perlu specific permissions

5. Apply Configuration

  1. Klik Execute
  2. Tunggu configuration selesai:
    – Starting Server
    – Applying security settings
    – Creating user accounts
    – Updating firewall
  3. Klik Finish setelah selesai

Verifikasi Instalasi

1. Check Windows Service

  1. Tekan Win + R
  2. Ketik services.msc β†’ Enter
  3. Cari MySQL80 (atau MySQL81)
  4. Status harus Running
  5. Startup type: Automatic

2. Command Line Test

# Buka Command Prompt sebagai Administrator

Navigate ke MySQL bin directory

cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"

Test connection

mysql -u root -p

Masukkan password root yang dibuat saat install

Jika berhasil, prompt akan berubah menjadi:

mysql>

Test query

SHOW DATABASES;

Exit

EXIT;

3. MySQL Workbench Test

  1. Buka MySQL Workbench dari Start Menu
  2. Klik Local instance MySQL80
  3. Masukkan root password
  4. Jika berhasil, akan terbuka dashboard

Environment Variables Setup (Opsional)

1. Add ke PATH

  1. Win + S β†’ ketik “Environment Variables”
  2. Klik Edit the system environment variables
  3. Klik Environment Variables button
  4. Di System variables, cari Path
  5. Klik Edit
  6. Klik New
  7. Tambahkan: C:\Program Files\MySQL\MySQL Server 8.0\bin
  8. Klik OK semua windows

2. Verifikasi PATH

# Buka Command Prompt baru
mysql --version

Output harus menunjukkan versi MySQL

Konfigurasi Post-Install

1. Secure Installation

mysql -u root -p

-- Di MySQL prompt -- 1. Remove anonymous users DELETE FROM mysql.user WHERE User = '';

-- 2. Remove test database DROP DATABASE IF EXISTS test; DELETE FROM mysql.db WHERE Db = 'test' OR Db = 'test\_%';

-- 3. Disable remote root DELETE FROM mysql.user WHERE User = 'root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');

-- 4. Reload privileges FLUSH PRIVILEGES;

-- Exit EXIT;

2. Create Application User

mysql -u root -p
-- Create user untuk aplikasi
CREATE USER 'app_user'@'localhost' IDENTIFIED BY 'AppPassword123!';

-- Grant privileges GRANT SELECT, INSERT, UPDATE, DELETE ON myapp.* TO 'app_user'@'localhost';

-- Flush FLUSH PRIVILEGES;

-- Verifikasi SELECT User, Host FROM mysql.user;

Troubleshooting

1. “Cannot connect to MySQL server”

Solusi:

# Check service status
sc query MySQL80

Start service jika stopped

net start MySQL80

Atau via Services

services.msc β†’ MySQL80 β†’ Start

2. “Access denied for user ‘root’@’localhost'”

Solusi Reset Password:
1. Stop MySQL service
cmd
net stop MySQL80

  1. Start dengan skip-grant-tables
    cmd
    cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
    mysqld --console --skip-grant-tables --shared-memory

  2. Buka Command Prompt baru
    “`cmd
    mysql -u root

FLUSH PRIVILEGES;
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NewPassword123!’;
“`

  1. Restart MySQL service normal

3. Port 3306 Already in Use

Solusi:

# Cek apa yang menggunakan port 3306
netstat -ano | findstr 3306

Ganti MySQL port di my.ini

C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

Ganti: port=3306 β†’ port=3307

Uninstall MySQL

1. Via Control Panel

  1. Win + S β†’ “Add or remove programs”
  2. Cari MySQL
  3. Klik Uninstall
  4. Ikuti wizard uninstall

2. Manual Cleanup (Jika perlu)

# Delete data directory (HATI-HATI! Backup dulu!)
rmdir /s /q "C:\ProgramData\MySQL"

Delete program files

rmdir /s /q "C:\Program Files\MySQL"

Hapus registry entries (opsional, advanced users only)

Best Practices Windows

  1. Gunakan strong password: Root dan application users
  2. Enable firewall: Block port 3306 dari public
  3. Regular backup: Gunakan MySQL Workbench Export
  4. Monitor service: Via Services atau Task Manager
  5. Update regular: Via MySQL Installer

Kesimpulan

Instalasi MySQL di Windows adalah proses yang user-friendly dengan MySQL Installer:
Download dari website resmi
Install dengan wizard yang terstruktur
Configure dengan security best practices
Verify dengan command line dan Workbench

Dengan MySQL di Windows, development environment Anda siap untuk database projects.

Ditulis oleh

Hendra Wijaya

Tinggalkan Komentar

Email tidak akan ditampilkan.