Results 1 to 22 of 22

Thread: Installing MySQL Server 5.5 on Windows 7

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Installing MySQL Server 5.5 on Windows 7

    Note: If you're planning to use MySQL with PHP, follow the tutorial Installing PHP 5.3 and Apache HTTP Server on Windows 7 first, if you haven't done so already.

    At the time of writing, the latest stable version is 5.5.13.


    Installing MySQL

    1. Get it from here:
      http://dev.mysql.com/downloads/mysql/5.5.html

      (Don't be fooled! You don't need to create an account. Follow the link "No thanks! Just take me to the downloads.")

      Grab the installer — it's much smaller than the zip archive.
      You can use either the 32 or 64-bit version. Both will work with a 32-bit PHP.


    2. Proceed through the wizard, selecting a 'Typical' installation.
      You will see a 'MySQL Enterprise' popup at some point. Dismiss it.


    3. Once the wizard has finished, the MySQL Server Instance Configuration Wizard starts.

    4. Select 'Detailed Configuration'.

    5. Select 'Developer Machine'.

    6. Select 'Multifunctional database'.

    7. Select a drive.

    8. Select 'Manual setting', then enter a small number of concurrent connections.

      Name:  mysql02.png
Views: 48352
Size:  57.1 KB

    9. The default server port is 3306. If you change this, you'll need to specify the port in any applications that connect to the server.

    10. Select 'Best Support for Multilingualism'. This will set the default character set to UTF-8.

    11. Select "Include Bin Directory in Windows PATH".

      Name:  mysql03.png
Views: 51228
Size:  53.7 KB

    12. Enter a password, then finish the wizard.
      The settings will be written to a file (my.ini).
      If the wizard freezes for more than about 20 seconds at this point, close it and run it again... It's in bin under the directory where you installed MySQL.


    13. Test the installation by running the MySQL command-line client.

      Name:  mysql04.png
Views: 48166
Size:  47.9 KB

    14. Create a test database. We'll use this in the next section.

      Name:  mysql05.png
Views: 45712
Size:  41.2 KB


    Configuring the MySQL Client

    If this is a development machine, you might want to set up your client to log in as 'root' by default. To do this, set up a file called my.cnf and place it in your C:\ directory.

    Code:
    [client]
    user=root
    password=PASSWORD
    (On Unix platforms, the MySQL client looks in your home directory for this file. Frustratingly, the Windows client does not do this.)


    Connecting to MySQL from PHP

    1. Open the php.ini configuration file in a text editor.

      Find the line ; extension_dir = "ext" and change it to:
      Code:
      extension_dir = "c:\php\ext\"
      (If you installed PHP into a different directory, use that path instead.)


    2. Find the line ;extension=php_pdo_mysql.dll and uncomment it by removing the semicolon.

    3. Restart the Apache server.

    4. Copy the following listing into a new file under your htdocs directory.

      Code:
      <?php
      	header('Content-type:text/plain');
      	$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', 'PASSWORD');
      	$st = $dbh->prepare('select bar from foo');
      	$st->execute();
      	var_dump($st->fetch(PDO::FETCH_ASSOC));
      ?>
    5. Navigate to that file using your web browser. You should see something like this:

      Name:  mysql06.png
Views: 45685
Size:  39.8 KB

    Great success!
    Last edited by penagate; Dec 9th, 2011 at 01:44 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width