MySQL:Windows Local installation

From virtualMV2015wiki
Jump to: navigation, search
 Home  MySQL <

Introduction

Overview

While MySQL can run on many platforms, we will concentrate on a local installation running in Windows.


Icon Objectives.png

Objectives

By the end of this page you will be able to:

  • Understand how MySQL runs as a service in Windows
  • Run MySQL in a Windows console
Figure 1. MySQL Windows Process


MySQL is created as a Windows Service, and runs as a Windows Process and once it is installed it will run in the background. This means that it will appear to be invisible, so how can you tell if it is running?

In Windows (if you have permission you can view the processes using [Ctrl]+[Alt]+[Del], see Figure 1)

To access the service (once running) you will need an application that knows how to communicate with it.

  • If you want to use MySQL in Windows
    • MySQL has a console which we can use.
    • Oracle/Sun provide MySQL Workbench which is a separate program that allows you to look at a database using a graphical user interface (GUI).
    • Another popular (Windows) application is EMS SQL Manager for MySQL. There is a freeware version which has some restrictions on it and an equivalent - but much more powerful- commercial version.
    • If you want to access MySQL using another database (like Microsoft Access) you need to provide a bridge that connects the two. A standardised way that has been developed is known as Open Database Connectivity (ODBC). There are interfaces (known as Application Programming Interfaces -APIs) for Visual Basic, Visual C++, SQL and drivers for databases like Access, Paradox, dBase, Text, Excel and Btrieve.
  • If you want to use MySQL on the Internet, you can
    • use ASP (with the ODBC Driver)
    • Use PHP (has native MySQL support)

So for now we will keep things simple and use the built in MySQL console.

Starting the console

Figure 2. MySQL Console in WindowsXP

The console is designed to run in a command window, which is text only (no pretty GUI!). This is available on all platforms (Windows, Unix, etc) and means that what you learn can be used on all the other platforms as well.

To open the command window, either

  • Start > Run > cmd.exe

or if the Run command is hidden

  • [Windows button]+[R]

Now you will need some of Folder commands:

  • DIR lists files and folders
  • CD allows you to change into a new folder

For example, if you have installed your own copy on your C Drive you may need to navigate to C:\Program Files\MySQL\MySQL Server 5.1\bin (Use Windows Explorer to find out the full path name)

  • C:\>CD "C:\Program Files\MySQL\MySQL Server 5.1\bin"

(or if you want to go slowly - you can DIR at any stage to check the folders)

  • C:>CD C:\Program Files
  • C:\Program Files>CD MySQL
  • C:\Program Files\MySQL>CD MySQL Server 5.1
  • C:\Program Files\MySQL\MySQL Server 5.1>CD bin

Now startup the console

  • C:\Program Files\MySQL\MySQL Server 5.1\bin> Mysql -u root -p
  • enter password:********

If you understand how command prompts work, you could create a batch file (that you can run) in notepad like

File: mysql.bat

 cd "\Program Files\MySQL\MySQL Server 5.1\bin\"
 Mysql -u root -p

Then when you want to fire up mySQL you only need to type mysql

Closing the console

  • Type exit at the mySQL prompt
  • Type exit at the Command prompt


Icon References.png References


MySQL:Windows Local installation. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved December 17, 2017, from http://www.virtualmv.com/wiki/index.php?title=MySQL%3AWindows_Local_installation    (zotero)