Databases Reference
In-Depth Information
You can run MySQL programs from the command window by first changing to the
MySQL directory:
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.0"
and then typing in the MySQL program name.
For example, you can stop the server directly by calling the mysqladmin program directly
from the MySQL installation directory. You would type (all on one line):
C:\Program Files\MySQL\MySQL Server 5.0> bin\mysqladmin \
--user=root \
--password= the_mysql_root_password \
shutdown
Never kill the MySQL server from the Windows task manager; you could lose data.
Starting and stopping MySQL from the command line
If the installation program could not install the service, you'll need to start and stop
the server from the command line. To do this, open a command prompt window and
change your working directory to the directory where the MySQL installation has been
installed. This is typically C:\Program Files\MySQL\MySQL Server 5.0\ :
C:\> cd C:\Program Files\MySQL\MySQL Server 5.0\
To start the server, type:
C:\Program Files\MySQL\MySQL Server 5.0> bin\mysqld-nt
Under Windows, executable programs such as mysqld-nt have the extension .exe . You
can include the full name and extension, as in mysqld-nt.exe ; if you leave it out, Win-
dows won't complain. If the program ends immediately, restart the server but add the
option no-defaults :
C:\Program Files\MySQL\MySQL Server 5.0> bin\mysqld-nt --no-defaults
This tells the server not to expect an options file—we discuss this in further detail in
Chapter 11. You may also be prompted by your firewall software to authorize the server
to listen for incoming connections from the network; unless you need to allow con-
nections from other computers, it's a good idea to keep blocking such connections.
Once the program's started, nothing exciting will happen—you'll just see a blinking
cursor; this command window will remain open as long as the server is running, so to
use any other MySQL command-line programs, you'll need to open another command-
prompt window.
For example, to shut the server down, you should open another command-prompt
window and change to the MySQL directory:
C:\> cd C:\Program Files\MySQL\MySQL Server 5.0\
and then stop the server by sending the shutdown command:
 
Search WWH ::




Custom Search