Keywords: MySQL | Windows XP | ERROR 2003 | Server Startup | Troubleshooting
Abstract: This technical paper provides an in-depth analysis of resolving MySQL ERROR 2003(HY000) on Windows XP systems, focusing on manual server startup via command line, service initialization procedures, console monitoring techniques, and alternative solutions through Windows Service Manager, offering systematic guidance for database deployment in legacy environments.
Problem Phenomenology and Root Cause Analysis
When users execute the mysql -u root command on Windows XP systems, they frequently encounter ERROR 2003(HY000): Can't connect to MySQL server on 'localhost' (10061). This error code clearly indicates that the MySQL client cannot establish a connection with the local server, with the fundamental cause being that the mysqld service process has not been started.
Command Line Startup Procedure
The MySQL server can be manually started from the command line, a method applicable to all Windows versions. The specific operational steps are as follows:
First, open a command prompt window and navigate to the bin subdirectory of the MySQL installation directory. The typical path is C:\Program Files\MySQL\MySQL Server 5.0\bin, though the actual path should be adjusted according to the specific installation location. Execute the following command to start the service:
shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld"
For real-time monitoring of server status, it is recommended to start in console mode:
shell> mysqld --console
This command will display server startup logs in the console window, facilitating immediate diagnosis of potential issues.
Service Shutdown and Security Management
When needing to stop the MySQL server, use the mysqladmin tool to perform a graceful shutdown:
shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root shutdown
If the root account has a password set, the -p parameter must be added and the corresponding password entered when prompted. It is particularly important to note that user accounts in the MySQL system are completely independent from Windows login accounts, with their permission management systems operating separately.
Advanced Troubleshooting Methods
When the mysqld service fails to start, the system generates detailed error logs. The default location is the C:\Program Files\MySQL\MySQL Server 5.0\data directory, with files having the .err extension. Analyzing these logs can provide specific error information and resolution clues.
For complex failures, try starting in debug mode:
shell> mysqld --standalone --debug
This command will generate a C:\mysqld.trace trace file, recording the complete server initialization process and providing technical experts with in-depth diagnostic evidence.
Alternative Solution via Windows Service Manager
When command line solutions fail, operations can be performed through the Windows Service Manager:
- Open the "Services" management console (services.msc)
- Locate MySQL-related entries in the service list
- Check service status, and if displayed as stopped, manually start it
- After confirming normal service operation, reattempt connection
This graphical interface solution provides an effective complement to command line operations, particularly suitable for user groups unfamiliar with command line interfaces.
Environment Configuration Essentials
Special attention must be paid to data directory initialization during initial MySQL deployment. Using mysqld --initialize-insecure creates a root account with an empty password, while mysqld --initialize generates a random initial password. After initialization is complete, establish connection via mysql -u root -p, handling the authentication process according to password configuration status.