dreamweaver MX - cant connect to mysql

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.
LVL 1
jezskillAsked:
Who is Participating?
 
v2MediaConnect With a Mentor Commented:
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
 
v2MediaCommented:
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
 
jezskillAuthor Commented:
It has created the folder but the connection file doesnt exist within it.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
v2MediaCommented:
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
 
jezskillAuthor Commented:
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
 
v2MediaCommented:
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
 
v2MediaCommented:
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
 
jezskillAuthor Commented:
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
 
v2MediaCommented:
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
 
jezskillAuthor Commented:
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
 
v2MediaCommented:
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
 
jezskillAuthor Commented:
Ok, yes the username/password/host in mysql permissions does match the user/password/host doing the conecting.
0
 
jezskillAuthor Commented:
Just windering what I should try next?
thanks
0
 
jezskillAuthor Commented:
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
 
jezskillAuthor Commented:
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
 
jezskillAuthor Commented:
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
 
v2MediaCommented:
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
All Courses

From novice to tech pro — start learning today.