A. Sidiq Purnomo

Universitas Mercu Buana Yogyakarta

You are here: » Creating and Configuring MySQL Database With WebMatrix

Creating and Configuring MySQL Database With WebMatrix

Step 1 : Requirements
For the create PHP with MySQL Database in the Microsoft WebMatrix,

  1. Requirements
  2. Creating PHP Site
  3. Open The Workspace and Creating PHP File

You can see in the url Creating PHP and MySQL Website With WebMatrix

Step 2 : Creating MySQL Database

  1. Open your MySQL Command Line Client. To open MySQL Command Line Client Go to Start Menu –> All Programs –> MySQL –> MySql Server 5.5 –>  MySQL 5.5 Command Line Client.
  2. If you have seen window “MySQL 5.5 Command Line Client”, type your password in dialog “Enter password” and press the button enter on the keyboard.
  3. Now you are ready to write SQL code, type below code to creating new database :
    MySQL > Create Database `DnDPHP`;
    image

Step 3 : Configuring MySQL Database Connections With Microsoft WebMatrix

  1. Click the Databases workspace selector to open the Databases workspace.
  2. In the navigation pane on the left, right click the “Other Connections”, and then click New Connections.
    image

     

  3. If you have seen window “Connect to Database”,
    • In the Name box, type your name database connection (example : DnDPHP).
    • In the Database Type, choose MySQL 5.x, 6.x.
    • In the Server box, type localhost.
    • In the Database box, type your database name (example : DnDPHP). This is the database that will hold your PHP Website contents.
    • In the Login box, type your username (example : root). This is username to access your database.
    • In the Password box, type your password. This is password to access your database.
    • Check in the Add to web.config check box,

    and then click the “OK” button.
    image

  4. You should see a window that looks like this :
    image

Step 4 : Checking your MySQL Database Connections

  1. Click the Files workspace selector to open the Files workspace.
  2. In the navigation pane on the left, right click the “DnD” Directory, and then click New File to creating the “PHP” file.
  3. The next step, if you see the “ConnectionMySQL.php” file in the workspace, now you are ready to write PHP code, type below code into it :
    <?php$connect = mysql_connect("localhost","[YourMySQLUsername]","YourMySQLPassword");if (!$connect){echo " Not Connected ...!!!";}mysql_select_db("DNDPHP") or die ("Database Indak Ado ...!!!");echo "Connected";?>

    and then save this file.

  4. To launch the “ConnectionMySQL.php” file in your browser, Click the “Runbutton in the WebMatrix ribbon and select your favorite web browser.
    image
  5. If you will see “Connected” then your MySQL Database Configuration works fine.
    image

Step 5 : Creating Table In MySQL Database With Microsoft WebMatrix

  1. Click the Databases workspace selector to open the Databases workspace.
  2. In the navigation pane on the left, right click the “Tables”, and then click New Table.
    image
  3. The next step, if you see the “(YourSite).NewTable” file in the workspace, In the column properties :
    • In the (Name) box, type your name database connection (example : DnDPHP).
    • In the Allow Nulls box, choose “False” to Not Null field or “True” to Null field .
    • In the Data Type box, choose data type for field (example : Int).
    • In the Default Value box, type default value for field (example : 0).
    • In the Is Identity? box, choose “False”.
    • In the Is Primary Key?, choose “True” for primary column in your table.
    • In the Length, type length for field (example : 2) .
    image
  4. In the navigation pane on the top, click the “New column” menu to add new column to your table.
  5. Save your table, press Ctrl+S on your keyboard, if you see the “Save Table” dialog,
    • In the Table Name box, type your name table (example : Identity).
    • And then click the “OK” button.
    image
  6. You should see a window that looks like this :
    image
  7. To insert data on the “Identities” table, In the navigation pane on the top, click the “Data” menu.
    image
  8. Open your MySQL Command Line Client, type below code to check your table :
    MySQL > Use DnDPHP;MySQL > Desc `Identity`;>MySQL > Select * From `Identity`;
  9. You should see a window that looks like this :
    image

Alternate you can download all step in PDF file :

Download pdf tutorial in this link –> “Creating PHP and MySQL Website With WebMatrix“.

* … Good Luck ! … *

By : DnD ~ Hanya Ingin Berbagi

Print Friendly, PDF & Email
Posted by 2 Responses
 

Free Email Newsletter

Stay Updates with this Blog. Get Free email newsletter updates..

And then confirm your email subcription

   

2 Comments to “Creating and Configuring MySQL Database With WebMatrix”

  1. Anonymous says:

    In choosing server type I only get SQL, no mysql, how can I get it to offer mode dbs than MS ones?

  2. DnD Sandy Ra says:

    You have to install MySQL manually before configuring the WebMatrix

    Please see how to install MySQL in the url "http://www.sq.web.id/2011/11/how-to-install-mysql-database-server-on.html&quot;

    subsequent re-configuration steps MySQL on WebMatrix

    good luck !

Leave your comment here:

Secure * Time limit is exhausted. Please reload the CAPTCHA.

Dec
20
2011