Creating the MySQL database

Creating the MySQL database

The sample files for Dreamweaver include a SQL script capable of creating and populating a sample MySQL database.

Before starting, make sure MySQL is installed and configured on your local or remote computer. Download the latest version from the MySQL website at http://dev.mysql.com/downloads/. For development purposes, download and install the Windows Essentials version of the MySQL database server.

To create the sample MySQL database:

  1. Copy the SQL script file, insert.sql, to an appropriate folder on the computer that has MySQL installed.

    If you installed Dreamweaver to its default location, the path to the script file is as follows:

    • C:\Program Files\Macromedia\Dreamweaver 8\Tutorial_assets\cafe_townsend\data\insert.sql (Windows)
    • /Applications/Macromedia Dreamweaver 8/Tutorial_assets/cafe_townsend/data/insert.sql (Macintosh)

    If the computer running MySQL is a Windows computer, copy the insert.sql script to Program Files\MySQL\MySQL Server 4.x\bin. If the computer running MySQL is a Macintosh, copy the insert.sql script to your Documents folder in your home folder.

  2. On the computer that has MySQL installed, start the MySQL Command Line Client (Windows) or the Terminal (Macintosh).
    • In Windows, start the MySQL Command Line Client by selecting Start > MySQL > MySQL Server 4.x > MySQL Command Line Client.
    • On the Macintosh, start the Terminal by going to the Applications folder, opening the Utilities folder, and double-clicking Terminal.
  3. In Windows, enter your username (if any) and password, and then press Enter.

    The MySQL client’s command prompt appears, as follows:

    mysql>
    
  4. On the Macintosh, enter the following command:
    mysql -uUser -pPassword
    

    For example, if your MySQL user name (also known as an account name) and password are Tara and Telly3, enter the following command:

    mysql -uTara -pTelly3
    

    If you don’t have a password, omit the -p argument as follows:

    mysql -uTara
    

    If you didn’t define a user name while configuring your MySQL installation, enter root as the user name, as follows:

    mysql -uroot
    

    The MySQL client’s command prompt appears, as follows:

    mysql>
    
  5. Create a new database by entering the following command at the MySQL prompt:
    mysql>CREATE DATABASE CafeTownsend;
    

    MySQL creates a new database, but it doesn’t contain any tables or records yet.

  6. Log out of the MySQL client by entering the following command at the prompt:
    mysql>quit;
    
  7. (Windows) Open the Windows command prompt by selecting Start > Run, and typing cmd in the Run dialog box.
  8. At the system command prompt, populate the new CafeTownsend database in MySQL.

    In Windows, use the following command:

    cd \
    cd Program Files\MySQL\MySQL Server 4.x\bin
    mysql -uUser -pPassword CafeTownsend < insert.sql
    

    On the Macintosh, use the following command:

    mysql -uUser -pPassword CafeTownsend < ~/Documents/insert.sql
    

    This command uses the insert.sql file to add tables and records to the CafeTownsend database you created in step 5.

After creating the MySQL database, create a database connection to it in Dreamweaver. (See Creating a database connection.)



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
 
ASPTreeView.com
 
Evaluation has НКјЩЩХ¶Мexpired.
Info...