Documentation Home
MySQL and Windows
Related Documentation Download this Excerpt

1.5.6 Starting MySQL from the Windows Command Line

The MySQL server can be started manually from the command line. This can be done on any version of Windows.


MySQL Notifier can also be used to start/stop/restart the MySQL server.

To start the mysqld server from the command line, you should start a console window (or DOS window) and enter this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld"

The path to mysqld may vary depending on the install location of MySQL on your system.

You can stop the MySQL server by executing this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqladmin" -u root shutdown

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system.


Users in the MySQL grant system are wholly independent from any login users under Microsoft Windows.

If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. By default, the error log is located in the C:\Program Files\MySQL\MySQL Server 5.7\data directory. It is the file with a suffix of .err, or may be specified by passing in the --log-error option. Alternatively, you can try to start the server with the --console option; in this case, the server may display some useful information on the screen that will help solve the problem.

The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See The DBUG Package.

Use mysqld --verbose --help to display all the options that mysqld supports.

User Comments
  Posted by on March 19, 2005
if you don't mind having the winmysqladmin tool sitting in your taskbar, you can use the start command:

> start c:\mysql\bin\winmysqladmin

This will give you the prompt back.

Since my windows dev machine handles multiple environments, I need this in a bat script to start my web environment with a single move:

start c:\mysql\bin\winmysqladmin
"c:\program files\apache group\apache\apache" -k start

Then have the shutdown script do the reverse to stop them both.

  Posted by lakhya phukan on December 3, 2005
I have tested the following script in a batch file to start both apache and mysql in a development machine (windows 98 platform).

start c:\apache\apache
start c:\mysql\bin\mysqld-opt

To shutdown both apache and mysql i used the folloing script:

c:\apache\apache -k shutdown
c:\mysql\bin\mysqladmin -u root shutdown

Works fine for me.
  Posted by Anthony Jenkins on December 14, 2005
The above command-line examples try to execute commands with spaces in the path; such commands should be quoted:

C:\> "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld"
  Posted by Lalith Manage on April 21, 2007
There is no mysqld.exe in the bin folder in the version that I installed. So mysqld does not work from the console.

But mysqld-nt.exe is there. Shouldn't the documet be updated?
  Posted by Joseph Dietrich on June 6, 2007
Others have mentioned methods for using batch scripts for Apache and MySQL. If you have both servers installed as services, you can simply use:

net <action> <service-name>

So in my case, to start Apache and MySQL I use this batch file:

net start Apache2
net start MySQL

and to stop them, this one:

net stop Apache2
net stop MySQL

This avoids any nastiness with filenames, command options, or directory paths.

If you don't know the names of the services on your machine, check them in the Services MMC snap-in ("services.msc" from the Command Prompt or in Start -> Run...). You should also set them to run manually here, so that they start only when you want them to.
  Posted by Jacob Nikom on July 24, 2011
Another way to see where the error log file is to look into
my.ini files which is in the server directory:
dir "C:\Program Files\MySQL\MySQL Server 5.5\my.ini"
Volume in drive C is 1USL16375
Volume Serial Number is 504C-D5B9

Directory of C:\Program Files\MySQL\MySQL Server 5.5

07/24/2011 04:43 PM 8,955 my.ini
1 File(s) 8,955 bytes
0 Dir(s) 37,051,760,640 bytes free

In my.ini file there is a line
datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.5/Data/"

This line shows the directory where error log file is going to be.

Jacob Nikom

  Posted by Russell Lott on November 13, 2016
Regarding use of CYGWIN terminal ...

for anyone trying to run mysql from a cygwin terminal on a Windows box ...
you many encounter an issue where the command line interface seems to hang when you login.
This is an issue with cygwin that appears to have existed for a very long time.
By default, the system will use the instance of mysql.exe located in the mysql bin directory.
Cygwin doesn't play nicely with the mysql interface.
If you want to the CLI under Cygwin, you have to use *their* instance of mysql.exe ... make sure you have their latest and greatest version.

I switched to Powershell.
Sign Up Login You must be logged in to post a comment.