Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Date Date
Qty:
Subtotal
Promotions
Estimated Shipping
VAT
Calculated at checkout
Total
Checkout
Dreamweaver Help / 

Connect to MySQL database in Dreamweaver

Adobe Community Help


Products Affected

  • Dreamweaver

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

What's covered

  • MySQL configuration
  • Setting up the PHP / MySQL Site Definition in Dreamweaver
  • Create a MySQL database connection in Dreamweaver
  • MySQL utilities
  • Additional information

This TechNote describes a few of the important factors involved in creating a successful MySQL database connection when using the PHP server model in Dreamweaver. It will also cover some basic MySQL user account settings. It's assumed that you have installed and configured MySQL on a local or remote computer.

Errors will occur within Dreamweaver if setup is not completed correctly. A common error that can occur when testing a MySQL connection in Dreamweaver is "An unidentified error has occurred."

Note: This TechNote is meant to be a basic getting started guide. You should consult the MySQL documentation and other third-party resources to tailor the MySQL account settings to your specific security requirements. To download and install MySQL, visit the MySQL website or consult some of the third-party MySQL websites listed in Dreamweaver websites (TechNote 12607).

To the top

MySQL configuration

The default installation of the MySQL database system contains two databases named mysql and test. Themysql database contains six tables that store information about privileges. We will discuss two of these tables: the user table and the db table.

The user table stores information about who can connect to the MySQL server and whether the user has any global level privileges. Because privileges in the user table affect all databases on the MySQL server, usually administrators will have some Ys (yes) in the privilege fields while most standard users have only Ns (no). The db table specifies the databases on the MySQL server that users are allowed to access, and this table is where most of the standard users' privileges are stored.

Note: There are many graphic interface utilities available to help visually manage MySQL databases, however, this TechNote uses the native MySQL command line client.

Whether you install MySQL on a UNIX, Windows or Macintosh OS X machine, the command prompt window can be used to administer MySQL. In Windows, the command prompt is opened by selecting Start > Programs > Command Prompt. (On some systems, the Command Prompt may be located under Accessories in the Start > Programs menu.)

Change to the mysql\bin directory by entering the following commands at the command prompt:

> cd\> cd mysql\bin

During the MySQL installation, MySQL creates an account calledroot with no password, which can be used to log into the database. It is highly recommended that a password is assigned to this account since root has full control over the MySQL databases. To assign the root account a password run the following command, which will set the root password to new-password. You should replacenew-password with a password of your choice that is harder to guess.

> mysqladmin -u root password new-password

It is recommended that separate MySQL accounts are created for each PHP web application. You can create as many MySQL accounts as you wish and assign different rights and permissions to each account. Web application users do not need the same level of privileges as the root account.

To create a separate user account for your web application, connect to MySQL and log in with the superuser account using one of the following methods. In the example below, the account with superuser privileges is the root account. MySQL should prompt you to enter a password when you press the Enter key:

> mysql --user=root --password

or

> mysql -uroot -p

Once logged into MySQL, you will create a user calleddbuser (the name is arbitrary) for the web application. Below, are four examples of ways to set up this new user. In all four examples, a new user named dbuser is created. The four privileges granted to this user areSELECT, INSERT, UPDATE andDELETE on any table in the employees database (this database will be referred to as emp in the following examples). The password myPassword will be encrypted in the MySQL database.

  • In this example, dbuser can only access the database from localhost. GRANT SELECT, INSERT, UPDATE, DELETE ON emp.* TO dbuser@localhost IDENTIFIED BY "myPassword";
  • In this example, dbuser can only access the database from mySite. GRANT SELECT, INSERT, UPDATE, DELETE ON emp.* TO dbuser@mySite IDENTIFIED BY "myPassword";
  • In this example, dbuser can only access the database from mySite.myDomain.com. GRANT SELECT, INSERT, UPDATE, DELETE ON emp.* TO dbuser@mySite.myDomain.com IDENTIFIED BY "myPassword";
  • In this example, dbuser can access the database from any host. GRANT SELECT, INSERT, UPDATE, DELETE ON emp.* TO dbuser@"%" IDENTIFIED BY "myPassword";

After running the GRANT statement(s), switch from the emp database back into the mysql database by running the following command:

>use mysql

Execute the following SQL statement to observe what changes have been made to the db table in the mainmysql database:

SELECT Host, Db, User, Select_priv, Insert_priv,    Update_priv, Delete_priv   FROM db   WHERE User='dbuser';

Here is how the db table will look if all of theGRANT statements listed above are run:

Host Db User Select_

priv
Insert_

priv
Update_

priv
Delete_

priv
localhost emp dbuser Y Y Y Y
mySite emp dbuser Y Y Y Y
mySite.

myDomain.com
emp dbuser Y Y Y Y
% emp dbuser Y Y Y Y

Execute the following SQL statement to observe what changes have been made to the user table in the main mysql database:

SELECT Host, User, Select_priv, Insert_priv,    Update_priv, Delete_priv   FROM user   WHERE User='dbuser';

Here is how the user table will look if all of theGRANT statements above had been run:

Host User Select_

priv
Insert_

priv
Update_

priv
Delete_

priv
localhost dbuser N N N N
mySite dbuser N N N N
mySite.

myDomain.com
dbuser N N N N
% dbuser N N N N

Note: For security purposes, the dbuser account in the user table should not be modified unless the account needs administrative rights similar to theroot or the MySQL administrator account. If these privileges are granted, the dbuser will have access to the system database.

MySQL automatically reads the user anddb tables when it starts, and when GRANT and REVOKE statements are issued. If you make any manual changes to the user and db tables, reload the tables to process the changes using this command:

> flush privileges;
To the top

Setting up the PHP / MySQL Site Definition in Dreamweaver

A successful connection to a MySQL database in Dreamweaver depends on correct Site Definition entries when defining the site. Below, is a sample PHP / MySQL Site Definition that uses a Linux PHP server running on a machine identified as mySite.myDomain.com. MySQL is running on another machine identified as mysql1.myDomain.com and Dreamweaver is running on a local workstation. FTP is used to transfer files between the workstation and the Linux web server.

  • Local Info:
    • Site Name: mySite
    • Local Root Folder: C:\mySite\
  • Remote Info:
    • Access: FTP
    • FTP Host: mySite.myDomain.com
    • Host Directory: /htdocs/
    • Login: webadmin
    • Password: *********
  • Testing Server:
    • Server Model: PHP / MySQL
    • Access: FTP
    • FTP Host: mySite.myDomain.com
    • Host Directory: /htdocs/
    • Login: webadmin
    • Password: *********
    • URL Prefix: http://mySite.myDomain.com/
To the top

Create a MySQL database connection in Dreamweaver

Once the MySQL user account has been set up and the site has been defined, you can connect to your MySQL database in Dreamweaver. Using the above settings, here are example settings for the MySQL Connection dialog box in Dreamweaver:

Connection Name: choose a name (e.g. connEmp)

MySQL Server: mysql1.myDomain.com

User Name: dbuser

Password: myPassword

Database: enter the name of your database or click on the Select button to choose from a list of MySQL databases running on the server.

Note: For the MySQL Server field you must enter localhost if PHP and MySQL are running on the same machine.

 
To the top

MySQL utilities

There are third-party tools to help configure and manage a MySQL database without having to know SQL. These tools are helpful to those who prefer to work with databases through a visual interface rather than a command line interface. These tools can be downloaded and installed on the machine running the MySQL database or the local workstation. Some popular tools include: PHPMyAdmin, MySQL Control Center (MyCC), EMS MySQL Manager, urSQL, PremiumSoft MySQL Studio, and MySQLGUI.

To the top

Additional information

For more details on MySQL, see the MySQL documentation or the third-party MySQL sites listed in Dreamweaver websites (TechNote 12607).

 

See Also

  • Unidentified error occurs when testing a PHP / MySQL connection
  • Testing your PHP application server
Keywords: PHP; MySQL; db; database; MyCC; MySQLGUI; PHPMyAdmin; site; definition; define; administrator; tn_16575

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement