MySQL Console

The MySQL server can be administered from a command window. Uniform Server provides a short cut named MySQL console whichs opens a command window with the correct path to the MySQL utilities folder already set. Apart from cosmetics, it is identical to a standard command window.


This page focuses on using MySQL console. It is not intended as a definitive guide but just an introduction to show you how to access and use MySQL client.

UniServer 8-Coral
  Home
  Quick Start
  General
  Apache
» MySQL
  PHP
  MSMTP
  CRON
  DtDNS
  Db Backup
  Perl
  Main Index

Command window

Using a command window to administer the MySQL server is not specific to The Uniform Server. Running a standard command window is the same for any Windows MySQL installation. The Uniform Server’s MySQL console sets the paths and cosmetics transparently. With a command window open you can access the MySQL server utilities mysql client and mysqladmin. MySQL client allows you to run SQL commands, for example to create or delete databases. The following covers opening a standard command window and then The Uniform Server's preferred alternative MySQL console.

How to run a standard command window

To open a command window, run the command cmd from the start menu. Running a MySQL utility program requires navigating to its binary folder.

Note: The path where you installed The Uniform Server may be different; substitute your path as appropriate.


  1. Start a command window: (Start > click on Run > type cmd click OK)
  2. Alternatively: Click Start > All Programs > Accessories > click Command Prompt
  3. Type following lines into the command window:
    • cd \
    • cd C:\UniServer\usr\local\mysql\bin

The dialogue in the command window looks similar to that on the right.

Note: To use the command window you must have the MySQL server running.

 

Top

MySQL console command window short cut

Running MySQL console from UniController has a number of advantages. The button is enabled only when the MySQL server is running. Server location tracking allows the correct folder to be automatically selected when the console window is open. Opening a console window requires only a single button click.

  1. Start UniController
  2. Start MySQL server
  3. Click MySQL console button. Opens window shown on right

 

Top

Quick MySQL binary folder check

When running MySQL utilities, the working directory is changed to the MySQL folder: UniServer\usr\local\mysql\bin.

To check the working directory, type the dir command into either
of the above windows. The result should be as on the right.

  • mysql.exe - MySQL client runs SQL commands
  • mysqladmin.exe - MySQL admin
  • mysqldump.exe - Database dump
C:\UniServer\usr\local\mysql\bin>dir
Directory of C:\UniServer\usr\local\mysql\bin
21/06/2011 19:55   4,001,792 libmysql.dll
21/06/2011 19:54   4,106,240 mysql.exe
21/06/2011 19:54   4,037,632 mysqladmin.exe
21/06/2011 19:54   8,153,600 mysqld1.exe
21/06/2011 19:54   4,094,976 mysqldump.exe
C:\UniServer\usr\local\mysql\bin>

Top

Start MySQL Client

To start MySQL Client, type the following at the command window:

  • mysql -uroot -proot

Note 1: Do not copy and paste! Type the line in as shown.

  • -u stands for user name. Immediately follow that with the user name (no spaces)
  • -p stands for user password. Immediately follow that with the password (no spaces)


Note 2: The mysql> prompt indicates you are in MySQL monitor and it is ready to receive your commands.

Note 3: Quit MySQL monitor by typing the command exit

On successful connection, you will receive a message similar to this:

C:\UniServer\usr\local\mysql\bin>mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 5.5.14 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> exit
Bye

Top

Related topics

Set New MySQL root user password using MySQL Console
Restore MySQL root user password using command window
Create delete Database using command window
Create Restricted MySQL User using command window
Delete Restricted MySQL User using command window
Edit Restricted MySQL User using command window

Top