Tips for Installing / Using MySQL on Windows


Instructions For Windows Users:
Complete instructions are available here:

http://www.mysql.com/doc/en/Windows_installation.html

Below are my condensed instructions:

1. Download and install the Binary Files. Everything will
automatically be
stored in c:\Program Files\MySQL\MySQL Server 4.1\.

2. Once you have everything installed, MySQL should be running as a
service.


To find out, go to Start->Control Panel->AdministrativeTools->Services
and find the service called MySQL. It should be in state 'Started'.

3. Test that MySQL is running. Open a new DOS Window and type:

C:\Program Files\MySQL\MySQL Server 4.1\bin> mysqlshow -u root -p

It will prompt you for the administrative password you used during
the installation.
Once you enter the password, you should see something like this:

+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+

If you see this, great!

4. To access the MySQL Shell, type:

C:\mysql\bin> mysql -u root -p
Again, you will be prompted for the administrative password. You
should then see

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.1.10a-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

5. To shutdown MySQL, go to the Start->Control Panel->AdministrativeTools->Services,
find the MySQL Service, and stop it.


Trying things out:

1. Create a database databasename (you only need to do it once for one database)
mysql>CREATE DATABASE databasename;
(databasename is case-sensitive for unix environment)
mysql> show databases;
(You can use 'show databases;' to display what databases are in mysql)
mysql> USE databasename ;
(Select the databasename as the current database)
(Unzip the corresponding data files under the database's directory: by default at MYSQL_DIR/bin/mysql/databasename)
mysql> DROP DATABASE databasename ;
(Delete the databasename )

2. mysql> CREATE TABLE tablename (fieldname1 integer, fieldname2 varchar(10));
mysql> DROP TABLE tablename;

3. Load the data from file into the table tablename:


4. mysql>LOAD DATA INFILE "tablename_data.txt" INTO TABLE tablename fields terminated by '|';
(Note: you may need to remove the first line of each table which gives the description of the fields.)


5. Exit mysql:
mysql> \q


 

To try things out, download the menagerie examples from the MySQL
Tutorial: http://www.mysql.com/get/Downloads/Contrib/Examples/menagerie.zip/from/pick

Unzip this file, and follow the instructions in the README file.