Windows Specific MySQL Operation

Start/Stop MySQL Server in a Windows Command Window

  • Open a Windows command window to start the MySQL server
    • For error message logs to the window console (Good for development)
      cmd> mysqld --console
      
    • For error message logs to a file
      cmd> mysqld --log-error
      

      mysqld needs at least 1 option in the command line to start probably in Windows of the tested version

      Error messages will be logged in c:\mysql\data\my_host.err
      
    • Advance: Start the MySQL Server with a specific option file
      cmd> mysqld --defaults-file="c:\mysql\mysql-5.1\my.ini"
      
  • Stop MySQL in a Windows command window
    cmd> mysqladmin -u root -p shutdown

Start/Stop MySQL Server as a Windows Service

If MySQL is configured as Windows service, MySQL will be started automatically when the machine restart.

Otherwise:

  • Use Control Panel -> Administrative Tools -> Services -> MySQL to start/stop the service
  • Or in a Windows command window with "Run as administrator"
    To start:
    
    admin> net start MySQL
    
    To stop:
    
    admin> net stop MySQL