Cara Install MySQL di Windows 10 dan 11: Panduan Lengkap Server Setup
Cara Install MySQL di Windows 10 dan 11: Panduan Lengkap Server Setup
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
- Buka browser dan kunjungi: https://dev.mysql.com/downloads/installer/
- Pilih Windows (x86, 32-bit), MSI Installer
- Download mysql-installer-community-8.0.x.msi
- 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
- Right-click file .msi yang didownload
- Pilih Run as administrator
- Jika muncul Windows SmartScreen, klik More info → Run anyway
2. License Agreement
- Pilih I accept the license terms
- 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:
- Klik Execute untuk install otomatis
- Atau download manual dari Microsoft
- Restart komputer jika diminta
- Jalankan ulang MySQL Installer
5. Installation
- Klik Execute untuk mulai instalasi
- Tunggu proses download dan install (10-30 menit)
- Progress bar akan menunjukkan status
- 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
- Masukkan MySQL Root Password
- Ketik ulang di Repeat Password
- 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
- Klik Execute
- Tunggu configuration selesai:
- Starting Server
- Applying security settings
- Creating user accounts
- Updating firewall
- Klik Finish setelah selesai
Verifikasi Instalasi
1. Check Windows Service
- Tekan Win + R
- Ketik services.msc → Enter
- Cari MySQL80 (atau MySQL81)
- Status harus Running
- 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
- Buka MySQL Workbench dari Start Menu
- Klik Local instance MySQL80
- Masukkan root password
- Jika berhasil, akan terbuka dashboard
Environment Variables Setup (Opsional)
1. Add ke PATH
- Win + S → ketik “Environment Variables”
- Klik Edit the system environment variables
- Klik Environment Variables button
- Di System variables, cari Path
- Klik Edit
- Klik New
- Tambahkan:
C:\Program Files\MySQL\MySQL Server 8.0\bin - 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:
Stop MySQL service
net stop MySQL80Start dengan skip-grant-tables
cd "C:\Program Files\MySQL\MySQL Server 8.0\bin" mysqld --console --skip-grant-tables --shared-memoryBuka Command Prompt baru
mysql -u root FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword123!';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
- Win + S → “Add or remove programs”
- Cari MySQL
- Klik Uninstall
- 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
- Gunakan strong password: Root dan application users
- Enable firewall: Block port 3306 dari public
- Regular backup: Gunakan MySQL Workbench Export
- Monitor service: Via Services atau Task Manager
- 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.
Artikel Terkait
Link Postingan : https://www.tirinfo.com/cara-install-mysql-di-windows-10-11-server/