Download MySQL for Windows
Obtain the MySQL installation package from the official website. Select the appropriate version for your system and proceed with the download.
Extract Instalation Files
Extract the downloaded archive to a dedicated directory. It's recommanded to use a root folder such as D:\ for simplicity.
Configure System Environment Variables
Navigate to System Properties > Advanced > Environment Variables. Create a new system variable:
- Variable Name:
MYSQL_HOME - Variable Value: Path to your extracted MySQL directory (e.g.,
D:\mysql-8.0.23-winx64)
Edit the PATH variable and append: %MYSQL_HOME%\bin
Initialize MySQL Configuration
Create a my.ini file and a Data folder within your MySQL directory. Configure my.ini with the following settings, adjusting paths to match your installation:
[mysqld]
port=3306
basedir=D:\\mysql-8.0.23-winx64
datadir=D:\\mysql-8.0.23-winx64\\Data
max_connections=200
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8
[client]
port=3306
default-character-set=utf8
[WinMySQLAdmin]
Server=D:\\mysql-8.0.23-winx64\\bin\\mysqld.exe
Perform Initial Setup
Open Command Prompt as Administrator and navigate to the MySQL bin directory. Execute the initialization command:
mysqld --initialize --console
Record the temporary password generated during initialization. This appears after @localhost: and is essential for first-time login.
Install the MySQL service:
mysqld --install
Start the MySQL service:
net start mysql
Connect to MySQL using the root account and temporary password:
mysql -u root -p
Immediately change the default password after login for security purposes.