Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Manual Installation and Configuration of MySQL 5.7 on Windows

Tech May 13 1

Acquiring the Software

Navigate to the official MySQL Community Archives to obtain the specific 5.7 distribution package compatible with Windows. Ensure you select the ZIP Archive version for a manual installation setup.

Directory Structure and Preparation

Extract the downloaded archive to a desired location, such as C:\Database\MySQL57. Inside this root directory, create a new folder named data to store database files. Additionally, create a configuration file named my.ini in the root directory.

Server Configuration (my.ini)

Configure the initialization parameters using the following template. Adjust file paths to match your specific extraction directory.

[mysqld]
# Server Connection Settings
port = 3306

# Directory Paths
basedir = C:/Database/MySQL57
datadir = C:/Database/MySQL57/data

# Connection Limits
max_connections = 200
max_connect_errors = 10

# Character Set and Collation
character-set-server = utf8
collation-server = utf8_general_ci

# Storage Engine
default-storage-engine = INNODB

# Authentication Plugin
default_authentication_plugin = mysql_native_password

[mysql]
default-character-set = utf8

[client]
port = 3306
default-character-set = utf8

System Service Installation

Open the Command Prompt as an administrator. Navigate to the bin directory of your MySQL installation.

REM Initialize the database and generate a temporary root password
mysqld --initialize --console

REM Install MySQL as a Windows service
mysqld --install MySQL57

REM Start the service
net start MySQL57

If the standard installation command fails, use the Service Control (sc) utility to create the service manually by specifying the binary path and configuration file explicitly.

sc create MySQL57 binPath= "C:\Database\MySQL57\bin\mysqld.exe --defaults-file=C:\Database\MySQL57\my.ini" start= auto DisplayName= "MySQL 5.7 Server"

REM To remove the service
sc delete MySQL57

Initial Access and Credential Update

Log in using the temporary password generated during the initialization step. Once connected, update the credentials immediately.

-- Login to the server
mysql -u root -p

-- Update the root password for MySQL 5.7
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('NewStrongPassword123!');

-- Grant remote access privileges if necessary
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'NewStrongPassword123!' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Recovering Lost Root Passwords

If the root password is forgotten, restart the service with permission checks disabled to reset the credentials.

  1. Stop the MySQL service via the command line: net stop MySQL57.
  2. Start the server manually bypassing grant tables:
    mysqld --skip-grant-tables --shared-memory
  3. Open a new command prompt window and connect to the server:
    mysql -u root
  4. Reload privileges and update the password:
    FLUSH PRIVILEGES;
    USE mysql;
    UPDATE user SET authentication_string = PASSWORD('RecoveryPassword') WHERE User = 'root' AND Host = 'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  5. Restart the MySQL service normally and log in with the new password.
Tags: MySQL

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.