I have had this error, and found a zillion posts on the web
asking for a solution, and never found a solution. But I’ve kind of
figured out what’s going on and I’d like to know exactly how and
why it does what it does.

I have a Linux box lemon running MySQL, and a Windows XP
client orange. From orange I can connect using mysql command line
client (mysql -u root -p -h lemon mydatabase). I can also connect
using ODBC (by creating an ODBC connection in Control Panel and
testing the connection).

When I try to connect to lemon/root/password in Dreamweaver
CS3 by creating a MySQL Connection it fails with…

MySQL Error#: 1045

Access denied for user root@lemon (using password:YES)

(This is what a ton of posts complain about with lame
responses like – you got the password wrong).

So what I discover is that in Dreamweaver I have to set up
the connection using localhost instead of lemon. (NOTE: Dreamweaver
is running on orange – not lemon, where the MySQL server is
running!)

So I wonder – what the!!! The database is not on localhost.

So I fiddle a bit and find that if I go into Manage Sites and
change the name of the FTP host under Testing Server that the
connection to localhost breaks – so somehow the MySQL connection is
being made using the FTP host.

How is Dreamweaver making a MySQL connection using lemon as
the FTP server and localhost (orange) as the MySQL server, when it
is lemon that is the MySQL server???|||
.oO(nevdelap)

>I have had this error, and found a zillion posts on the
web asking for a

>solution, and never found a solution. But I’ve kind of
figured out what’s going

>on and I’d like to know exactly how and why it does what
it does.

>

> I have a Linux box lemon running MySQL, and a Windows XP
client orange. From

>orange I can connect using mysql command line client
(mysql -u root -p -h lemon

>mydatabase). I can also connect using ODBC (by creating
an ODBC connection in

>Control Panel and testing the connection).

You know that working on a DB as root is a bad idea? You
should create a

normal account for the daily work and login as root only for
maintenance

or configuration stuff.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16575#use rAccount

> When I try to connect to lemon/root/password in
Dreamweaver CS3 by creating a

>MySQL Connection it fails with…

>

> MySQL Error#: 1045

> Access denied for user root@lemon (using password:YES)

>

> (This is what a ton of posts complain about with lame
responses like – you got

>the password wrong).

>

> So what I discover is that in Dreamweaver I have to set
up the connection

>using localhost instead of lemon. (NOTE: Dreamweaver is
running on orange – not

>lemon, where the MySQL server is running!)

>

> So I wonder – what the!!! The database is not on
localhost.

Every machine is a localhost from its own point of view.
Since the DB

and probably your scripts both run on lemon, from their point
of view

that machine is the localhost and PHP has to open a
connection to

‘localhost’ in order to connect to the DB. This is the most
common setup

if PHP and MySQL run on the same machine.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16575#dbc onn

But one thing confuses me. You said you can connect from your
Windows

box, using the command line:

mysql -uroot -p -hlemon mydatabase

Does the same command also work if invoked directly on the
Linux box or

does it cause an “Access denied”?

> So I fiddle a bit and find that if I go into Manage
Sites and change the name

>of the FTP host under Testing Server that the connection
to localhost breaks –

>so somehow the MySQL connection is being made using the
FTP host.

>

> How is Dreamweaver making a MySQL connection using lemon
as the FTP server and

>localhost (orange) as the MySQL server, when it is lemon
that is the MySQL

>server???

FTP is used to transfer the scripts to the server.

Micha

|||
Cheers Micheal, but no – you have misread.

I know how IP works, I know what localhost means, I know
exactly what FTP does.

Yes, MySQL and Apache2 are both running on lemon – but
Dreamweaver is running on orange – when it is talking to MySQL to
get the names of the databases, etc, and the connection with
‘mysql’ and with ODBC is on orange. The question is nothing to do
with PHP. I am talking about Dreamweaver talking to MySQL, not the
PHP scripts talking to MySQL – which yes I know – they run on
lemon.

‘mysql -u root -p -h lemon mydatabase’ – Works from the
Windows (orange) and Linux (lemon) command lines. (Yes – spaces
between the -u and -h and the user name and host name – I read a
post saying there must not be spaces – but it works either way).

So, in the Connection configuration dialog when it connects
to MySQL when you click Select next to Database – this is nothing
to do with FTP – and hence the point of my question.

DreamWeaver is making a database connection specifying
localhost – when making the MySQL connection FROM orange TO lemon -
nothing to do with FTP, and is nothing to do with PHP – and yet the
FTP configuration for the testing server in the site configuration
is what is making the difference.

So thanks for the link – it says
Note: For the MySQL Server field you must enter localhost if
PHP and MySQL are running on the same machine.

I just want to understand precisely why this is?

Perhaps I am not making myself clear, or perhaps I should
just accept it and move on. :) |||
I have just figured out that if I connect to lemon’s IP
address instead of specifying localhost then it connects, so what I
want to know is how is Dreamweaver making the connection – it is
not the equivalent of doing a ‘mysql’ at the command line of the
machine that Dreamweaver is on, it’s more like it’s the equivalent
of doing a ‘mysql’ inside an ssh session to lemon, which it is
certainly not doing because I’m running ssh on a non-standard port
on lemon so it can’t be.

lemon has two network cards and when it resolves it’s name it
talks to itself on one address, when orange resolves it’s name it
talks to it using the other address (not visible to the other
subnet), and it’s the first (talking to itself) address that
Dreamweaver needs to be talking to – even though orange can’t see
it on that address.

I’m probably missing something completely obvious and I’ll
kick myself when I realize what it is.

(BTW, it is only MySQL’s root login that I’m connecting to
while I am trying to figure out why I’m getting the access denied.
The Linux root account is disabled.)|||
It’s all become clear now that I’ve notice the php file that
it’s using to connect. I was sent off on a tangent by a post
telling me I needed to install the MySQL ODBC driver, even after
I’d assumed it was talking directly to MySQL. So my problem was
simply caused by my network configuration that I described and that
if lemon only had one IP address it would have all just worked and
I would never have questioned it.

Makes me wonder though how Dreamweaver does if you’re not
doing a php based site, and don’t have php installed on the server.
But after uninstalling php5 and restarting apache2 all the php
stuff continued to work, so I didn’t figure it out, but now I
understand what it’s up to.

Cheers.

(Still doesn’t answer why there are so many posts on the web
asking about the same error though).

Related posts:

  1. MySQL Error: # 2002
  2. DW, JSP, MySQL and Mac OSX
  3. connect MySQL to Coldfusion MX 7
  4. add data source error
  5. asp.net and mysql

Related posts brought to you by Yet Another Related Posts Plugin.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 free icons download Suffusion theme by Sayontan Sinha

Featuring Recent Posts WordPress Widget development by YD