PHP and MySQL in Dreamweaver MX

This tutorial will walk you through the following:

  •  Installing MySQL
  •  Set up of phpMyAdmin
  •  Creating your database
  •  Connecting to database
  • Introduction

    MySQL is an extremely popular Open Source database management system that is licensed under the Gnu General Public License.  It is available for almost all of the popular OS platforms and most Internet Service Providers will have MySQL installed and available for you to use as part of your hosting contract.  For those of you who are writing applications that will violate the GPL. MySQL also offers a commercial license, which is very reasonably priced.  We're not going to get into the details of what does and does not constitute a violation of the license - the MySQL web site has the full details (http://www.mysql.com/products/licensing.html) and examples of what you can and can't do with it.  What we will be doing in this article and the next is getting an overview of how you can get going with PHP and MySQL in Dreamweaver MX.  This article will concentrate on getting it all up and running.

    Getting and setting up MySQL

    The first thing that you will need to do is get and install MySQL.  We're going to assume that you've managed to get PHP installed and configured for your web server, be it IIS, Apache or  any of the many others. 

    As we said earlier, MySQL is Open Source, so if you are that way inclined, you can grab the MySQL source code and compile it yourself.  For those of you who just want to get it up and running with minimal fuss, the MySQL web site provides binary installation versions of MySQL for you to download and install. 

    MySQL is currently available as two different versions. Version 3.23 has been tested extensively in production environments and is the version you should use if you intend to deploy your application in a production environment. 
    Version 4.0 is currently in gamma - it's beyond the beta stage, and has been used for over 2 months without any serious bugs.  You should choose this version if you are doing new development.  I use version 4.0 for all of my internal development and testing and it has been perfectly stable.  The additional features in version 4 include speed enhancements, a new storage engine that supports transactions and low-level locking, and several other enhancements.  At the time of writing Version 4.1 was announced as available, but there are currently no binary versions - source code only.

    When you come to download MySQL you will notice that you can choose between Standard and Max.  The Max version includes features that have not been thoroughly tested as well as debug information and should be used only if you wish to make use of these features.  Since we won't be using any of the additional features introduced by version 4.0, you can download and install whichever version you prefer - http://www.mysql.com/downloads/index.html

    Most hosting companies will already have MySQL set up for you, so we'll look at setting up MySQL for developing on your local machine.  The Windows installation comes in the form of a Windows setup program - simply unzip the archive and run the SETUP.EXE file and install MySQL to its default location of C:\mysql.

    To start MySQL, open a Command Prompt and change to the C:\mysql\bin folder.  Type the command

    C:\mysql\bin>mysqld --console

    This should display the message mysqld: ready for connections.  You can now either leave this window minimized, and move onto setting up phpMyAdmin, or if you are running Windows NT, 200 or XP, install MySQL as a service.  To do this stop the current console version of MySQL in the Command Prompt by typing Ctrl-C.  When you are back at the prompt, type

    mysqld --install

    MySQL will now appear in your Services control panel and you can start and stop it from there.

    Allan Kent

    Allan KentAllan comes from Cape Town, South Africa. He has been implicated in writing for several WROX, glasshaus, Wiley and Apress publications, generally in the 'cool stuff that PHP can do' sections.

    You can catch up with him at his website http://www.mediafrenzy.co.za.

    See All Postings From Allan Kent >>

    Comments

    DBTools is better!!!

    February 25, 2003 by Mané da Ilha
    I think that DBTools manager is better then phpmyadmin. Please, look at this www.dbtools.com.

    Sorry!!!

    February 25, 2003 by Mané da Ilha
    Sorry, the correctly URL is www.dbtools.com.br/EN.

    RE: Sorry!!!

    February 25, 2003 by Tim Green
    Except that DBTools is a Win32 Executable, rather than a web-based administration system. The advantage of phpMyAdmin is that you can ensure that your MySQL databases are administrable from anywhere, regardless of platform.

    DBTools has no such strength.

    It worked for me :o)

    March 2, 2005 by Harry Nibble

    Thanks for this tutorial.

    I had a few questions like "what does that mean" or "now what" but that was to be expected because I was not setting this up on a local machine.   As the tutorial was aimed at a local machine, there is little surprise there.   Also  for some strange reason I could not use phpMyAdmin and had to use Webmin as already installed.

    The part that really helped me was getting DMX to connect.   The followup tutorial was even much more helpful.

    Thanks for a brilliant tutorial 

    See all 7 Comments

    You must me logged in to write a comment.