| Setting up DreamWeaver with MySQL |
|
|
|
|
How to connect to your shared hosting account MySQL database connection using Dreamweaver 8. This tutorial was created in response to a huge outcry of Dreamweaver 8 users wishing to connect to their MySQL database and utilize the interface functionality of dragging and dropping recordsets and server bindings in DW 8. Connecting through Dreamweaver MX 2004 or 8 to one of disparate configurations of hosting environments can prove to be quite arduous and frustrating. I have been able to connect to 5 different hosting companies, virtual, dedicated and shared. One of the most common problems is understanding the MySQL structure, and connectivity to databases stored within.
First of all, the login and password to a database created with MySQL is completely different than your FTP server login and password. Check with your hosting company if there is a password and login that you must use to connect with MySQL. They may even have a database URL to use that is different than what is explained below (localhost) Most hosting companies give you access via PLESK or CPanel to manage your databases. I have worked with Globat.com, 1and1.com, Verio.com, ThePlanet.com, Servermatrix.com InMotionHosting.com and DreamHost.com. I have also directly connected to a server at my Institution and was able to navigate through the tables of the databases with Dreamweaver 8. All of which use PhpMyAdmin to upload and manage databases.
Server Scripts:Our friends at Macromedia have installed some dynamic PHP pages that interact with MySQL in order to force Dreamweaver MX 2004/8 to communicate with the Database while connected via FTP. These scripts are stored in a subdirectory of your root directory (or any directory that you are storing your PHP Dynamic pages) called _mmServerScripts. You do not have to create this directory or upload the scripts inside. The scripts inside are: MMHTTPDB.php & mysql.php Both of these PHP scripts allow Dreamweaver to make a connection to your MySQL database. The first one is configured for the computer you are currently working on. It allows the connection from your current IP to the website's IP (or domain name) If you change computers from home to school or work, you have to delete these scripts from that directory on the web server. When you create a new connection, a new MMHTTPDB.php files is created that identifies the connection to your current local machine. If you change local computers, then you will receive a connection error when attempting to locate databases in MySQL with Dreamweaver. It will never establish that connection or use the second PHP script which is actually the interpreter/communicator file that talks to the MySQL database. When you make an attempt to connect to your Database through Dreamweaver, these scripts are uploaded to the base directory detailed in your defined "Site"configuration which we will look at now:
With regards to the Local Info panel, make sure that you put the proper HTTP address of your website i.e. http://www.fizboo.com REMOTE CONNECTIONS
Remote info includes the FTP (domain name) the host directory, where you are putting your files including PHP pages that will be connecting to MySQL.
Put in your FTP login and password. You can select "Use passive FTP" without any issue in connecting. Test this connection to see if Dreamweaver has made a successful connection. HOST DIRECTORY WHERE DO YOUR PHP/HTML Pages live? Make sure you put the directory, in some cases it's "public_html" this is where your index.html page lives. This directory could be called "www" or "httpdocs" as well. This also know as the web root of your server. It's the folder that Apache has created so that when someone types your URL in a browser, it finds your site's pages. TESTING SERVER Change this URL to your Website URL ![]()
Select "PHP MySQL" as the server model for your Testing Server configuration. Then select "FTP" for Access. Dreamweaver will Auto-populate the remaining fields that you had programmed into the "Remote" configuration. If you notice the "URL prefix:" window it will have your website address with the directory that you've designated as your documents directory. You need to change this value. This is where most of the connection problems happen when trying to connect to MySQL. I have http://fizboo.com/htdocs when it should read: http://www.fizboo.com (Remember, you put your website address in that field, not my FIZBOO.COM !) For some reason the people at Macromedia think that you need to put your HOST DIRECTORY location here, it's a bug as far as I am concerned. The reason that this field should only show your actual website address is that those _mmServerScripts live in the web root directory and when you go and connect Dreamweaver to your website, it must "talk" to those scripts that are living in the html documents directory in order to open a line to MySQL on your server. Save your settings and create or open a PHP page in Dreamweaver 8 File| New| Php
CONNECTING TO MYSQL: Make sure that you have your "Databases" panel open inside of Dreamweaver MX 2004 /8 or hit Cntrl+shift+F10 in Windows. Click on the "+"symbol to make a new "Connection"
The "MySQL Connection" will appear and you select it. The following panel will open:
Observe the process of connecting to your server and MySQL. You will see Dreamweaver open the connection in FTP, upload those _MMServerScripts and the show the databases on the machine. If you have a slow connection, this can quite a while and sometimes it will Timeout. At this time you are directly connected to your database and you can drag and drop all of the fields that you have listed in the table of your database. Move on to the Tutorials
|
||||||||||
| Last Updated on Saturday, 17 November 2007 09:38 | ||||||||||











