Solved

dreamweaver  MX - cant connect to mysql

Posted on 2009-04-13
17
243 Views
Last Modified: 2012-05-06
I have managed to connect using a php test script that resides in the root folder , but when I try and connect to MYSQL from Dreamweaver using the database Mysql connection option, I add the settings which I believe to be correct and then test or apply and I get returned an "Un-identified error has occurred". Please help.
0
Comment
Question by:jezskill
  • 9
  • 8
17 Comments
 
LVL 19

Expert Comment

by:v2Media
ID: 24134769
Does DW successfully create the connection file? You'll find it in a folder called 'connections' and the file should have the same name that you defined when setting up the MySQL connection in DW.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24141489
It has created the folder but the connection file doesnt exist within it.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24143485
Try saving the file manually in the "Connections" folder. Call it "conn.php" and paste the following contents in it, then enter the database values and save.


<?php

# FileName="Connection_php_mysql.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_conn = "localhost";

$database_conn = "databaseName";

$username_conn = "username";

$password_conn = "password";

$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR); 

?>

Open in new window

0
 
LVL 1

Author Comment

by:jezskill
ID: 24161792
Now when I open Dreamweaver, it shows theres a connection in right hand task pane, but there are no tables when I drill down, if I right-click on the connection , choose edit connection and choose test connection , the unidentified error pops up again.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24163184
OK, so DW can't connect to MySQL. I suspect the MySQL service isn't running or MySQL isn't configured properly. Where is the MySQL svr that you're trying to connect to, local on your computer/network or external on the web?

If local, can you use another app such phpMyAdmin to connect and manage the databases? If external on the web, is the external server configured to accept connections from your IP?
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24163225
Be sure that whichever MySQL server your connecting to has an appropriate host set for the database to accept connections from. Try using a wildcard '%' host as a last resort.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24184006
MySQL is local on my machine, I am able to manipulate databases, create table and edit date using MYSQL Administrator application.

The hostname set is the local machine name i.e. jez-notebook.

Just out of interest , I have noticed that all php script tags visible in Dreamweaver appear to be bright red colour as if you may have if the code was iilegal or not known. Is this correct?
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24189483
ok - so can you check whether you have a valid host for the user associated with the database? Also, do you have php and iis or apache installed?

The red tags in DW code view is the correct colour.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:jezskill
ID: 24197471
sorry please could elaborate as to what a valid host is, I have php installed and also Apache on port 8080 as IIS is installed also.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24200015
MySQL has 2 entities involved in authentication before a connection to a database is allowed, user and host. Host is the IP address of the computer/server. The username/password/host that is listed in MySQL permissions to a database must match the user/pass/host doing the connecting.

If you don't understand at this point - you need to read more MySQL Administrator documentation. Read the help files for adding a host to a user associated to a database. http://www.techotopia.com/index.php/The_MySQL_Administrator_Tool
0
 
LVL 1

Author Comment

by:jezskill
ID: 24202536
Ok, yes the username/password/host in mysql permissions does match the user/password/host doing the conecting.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24231816
Just windering what I should try next?
thanks
0
 
LVL 1

Author Comment

by:jezskill
ID: 24233266
I have deduced that I cant prove that I am connecting to MYSQL using a php script, how can I prove this. What Can I add to the script to prove the connection?

thanks
0
 
LVL 19

Accepted Solution

by:
v2Media earned 500 total points
ID: 24234143
Use some debug code - save your original DW db connection file as something else, then use the one below. Test a page on the site that uses a db connection and the javascript alert window will tell you if the script has connected successfully or not.
<?php

# FileName="Connection_php_mysql.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_conn = "localhost";

$database_conn = "databaseName";

$username_conn = "username";

$password_conn = "password";

$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);

//debug db conn

if($conn) {

?>

<script type="text/javascript" language="javascript">

   alert('Connection to <?php echo $database_conn; ?> OK.');

</script>

<?php } else { ?>

<script type="text/javascript" language="javascript">

   alert('Connection to <?php echo $database_conn; ?> failed.');

</script>

<?php } ?>

Open in new window

0
 
LVL 1

Author Comment

by:jezskill
ID: 24234981
Ok, that worked , it says connected Ok, so am I to asume its a dreamweaver issue? PHP and Apache seem to be configured ok? just to confirm my dreamweaver site config set up is as follows;
Local Info
Local Root folder C:\InetPub\wwwroot
HTTP Address http://localhost:8080/

Testing Server
Testing server folder c:\inetpub\wwwroot\
url prefix    http://localhost/

In fact when I looked at this I went straight to edit sites and changed the url prefix to add my port 8080 on the end and now the connection works. Thank god , I have read that people get stuck on this for days on end. thanks for the assistance.
0
 
LVL 1

Author Closing Comment

by:jezskill
ID: 31569471
It seems that are many reasons why dreamweaver throws up an un-identified error which doesnt prove to very informative. Its just a case of systematic trial and error. I thought it might be do with Apache and PHP but I have read over 20 web postings on this , and I was quietly confident that i had it set up right., thanks again.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24235173
You should have mentioned the 8080 port config at the beginning...

It's safe to leave the http address empty in the local definition, ignore the warnings; just be sure to use doc relative links, not site relative. All you need there is the local root folder. For the testing site definition, when you're using inetpub/wwwroot, create a parent folder for each project for eg inetpub/wwwroot/siteOne/. Reason being, DW won't let you define another site in the same folder.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now