First Steps: MySQL v5.5 Download & Install
(Free Web Tutorials)
by Michael Thomas
MySQL Home Page
In this tutorial you will download and install MySQL.
Note: On the MySQL Home page, you can download
the whole MySQL site (all content, tutorials & examples) !!!
This tutorial covers: MySQL 5.5.16 (as of 10/10/11)
Prerequisites
- No prerequisites
- This tutorials has been tested in the following environment:
Date: 10/10/11
OS: Win 7
Objectives
- Download and install MySQL
- Test the install.
General Info
- MySQL is a key part of LAMP (Linux, Apache, MySQL, PHP/Perl/Python), the
fast-growing open source enterprise software stack.
- MySQL Workbench is a unified visual tool for database architects,
developers, and DBAs. MySQL Workbench provides data modeling, SQL
development, and comprehensive administration tools for server
configuration, user administration, and much more.
- Oracle owns MySQL.
MySQL Download (verion 5.0.51b)
- Download MySQL
- www.mysql.com - click the tab "MySQL.com",
then click "Downloads"
- Click "Download" button for "MySQL Installer for Windows" (All MySQL
products. For All Windows Platforms. In One Package.)
- Details: Windows (x86, 32-bit), MSI Installer - 5.5.15 - 184.8M
(Or the latest version)
(mysql-installer-5.5.15.0.msi)
- Note: This download has all of the free products for Windows
in one package.
- Click "Pick a Mirror".
- You can register if you want to but it is not required.
You have the option to click "No thanks, just take me to the downloads!
"
- Choose a mirror site that is close to you. Click "HTTP" or
"FTP" to download (I normally choose HTTP.)
- Install MySQL
- It is always advisable to make a backup if you already have a
version of MySQL installed.
Also, the install will attempt remove any prior versions.
There is a possibility that you may have to take some steps to remove
the current install. More info below.
- Run the ".msi" file you download.
- Screen: Choose a Setup Type
Click "Developer Default"
Install Path: C:\Program Files\MySQL\
Data Path (default): C:\ProgramData\MySQL\MySQL
Server 5.5
(Note: I don't like spaces in directory names. I use:
c:\mysqldata\)
- Developer Default vs Full - I'm not sure what the difference is.
"Developer Default" does the following:
Installs the MySQL Server and the tools required for MySQL application
development. This is useful if you intend to develop applications for an
existing server.
This Setup Type includes:
* MySQL Server
* MySQL Workbench- The GUI application to develop for and manage the
server.
* MySQL Visual Studio Plugin - To work with the MySQL Server from VS.
* MySQL Connectors - Connector/Net, Java, C/C++, OBDC and others.
* Examples and tutorials - To help you get started with your
development.
* Documentation - Allows you to read the documentation offline.
- Click "Next"
- Screen: Check Requirements - if you get this screen, follow the
instructions. Checks/Installs these products.
Microsoft Visual C++ 2010 32 bit run time MySQL Workbench
Microsoft .NET Framework 4 Client Profile MySQL Workbench
- Click "Next"
- Screen: Install Progress
- Click "Execute", "Next"
- Screen: "Configuration Overview"
- click "Next"
- Choose "Developer Machine"
- Keep the defaults:
- Port (Default): 3306
- Windows Service Name: MySQL55
- MySQL Root Password: <enter one and put in a safe place!>
- click "Next" as needed.
- Screen: Installation Complete
- Test your install
- MySQL Manual Docs
- PDF: MySQL 5.5 Reference Manual - open it up!
C:\Program Files (x86)\MySQL\MySQL Documents\refman-5.5-en.pdf
- You can also view the docs from the MySQL Workbench (next
steps).
- MySQL Workbench
- Launch MySQL Workbench: Start, MySQL, MySQL Workbench 5.2 CE
- Click on the first ICON in the upper right corner called "MySQL Doc
Library". This is your docs!
- Click on the "Home" icon that looks like a house in the far upper
left corner to take you back to Home.
- Click on the "Doc Library" tab to take you back to the docs.
Click on the "Home" icon to take you back home.
- In the section "Open Connection to Start Querying", click on "Local
Instance MySQL55" to connect to that installed instance.
Enter your password.
- You should see DBs that are installed. You probably have 2
from the default install: sakila & world
- Click on the "Home" icon that looks like a house in the far upper
left corner to take you back to Home.
- Click on the "SQL Editor (Local Install....)" tab to take you back
to the editor.
- Click on the "Overview" tab (which should be selected by default) to
see a list of DBs.
- Test running SQL code:
- In the SQL File section type:
select "Hello";
- Next press: CTRL-Enter (or choose from menu: Query, Current
Statement)
- Click on the tab: SQL File X Results 1
Results: Hello
- On the next line type:
select "World";
- Next press: CTRL-Enter (or choose from menu: Query, Current
Statement)
- Click on the tab: SQL File X Results 1
Results: World
- Next press CTLR-Shift-Enter (or choose from menu: Query, Execute
(All or Section)
- Click on the tab: SQL File X Results 1
Results: Hello
- Click on the tab: SQL File X Results 2
Results: World
- Click on the "Output" tab to see a history of the commands you have
run.
- In the SQL File section remove all the commands, run the
following commands and view the results:
(Note: This will only work if you have the "world" DB.)
- select * from world.city;
- In the SQL File section remove all the commands, run the
following commands and view the results:
- use world
- select * from city;
- Change the select statement to the following:
select * from city where name = "Atlanta";
- Click on the "Home" icon that looks like a house in the far upper
left corner to take you back to Home.
- MySQL command line
- Start, All Programs, MySQL, MySQL Server 5.5, MySQL 5.5 Command
Line Client, <enter password>
- mysql> status <enter> (Note: Should show status info).
- mysql> help <enter> (Note: shows help info)
- mysql> use world; (This will connect to 1 of the 2
default DBs normally installed.)
- mysql> select * from city where name="Atlanta";
- mysql> select * from city where countrycode = "USA";
(This will list the 274 USA city records from the table.)
- mysql>quit <enter> (exits to the command line tool).
- Your finished (unless you want to look at the reference material below).
Reference Only Material
MySQL Notes
- Windows PC
- MySQL Service - Make sure that it is running!
- Options for Windows 7
- Start, Control Panel. (I like to click in the upper right
corner View by: Small Icons)
- Administrative Tools, Services
- Look for "MySQL55"
- Optional Info for reference:
Path to executable: "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld"
--defaults-file="C:\ProgramData\MySQL\MySQL Server 5.5\my.ini"
MySQL55
Startup Type: Automatic
- Options for Windows XP
- Start, Settings, Control Panel, Administrative Tools,
Services
MySQL Install Errors: (Notes Only)
- Error #2003 - "Can't connect to MySQL server on "localhost"
(10061)
- Could be firewall issues. (Open port 3306) - close down your
firewall and then press "Retry".
- Note from an install error: If you are re-installing
after you just uninstalled the MySQL server please note that the
data directory was not removed automatically. Therefore
the old password from your last installation is still needed to
connect to the server. In this case please select skip now
and re-run the Configuration Wizard from the start menu.
- Error: 0 - Could not start the service MySQL. Error: 0 - could
not start the service.
- Error
- Screen Error: Could not start the service MySQL. Error: 0 - could
not start the service.
- Event Viewer Application Log:
The description for Event ID ( 100 ) in Source ( MySQL ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. You may be able to use the /AUXSOURCE= flag to retrieve
this description; see Help and Support for details. The following
information is part of the event: Aborting
- Uninstall MySQL
Option #1:
Run Setup.exe and choose: Remove
Option #2:
From the Control Panel, "Add or Remove Programs".
- Make sure the "MySQL" service doesn't exist anymore (Control Panel, Administrative
Tools, Services).
- Reboot your PC.
- Delete the Program Directory for MySQL. ex: C:\Program Files\MySQL