Access Denied for user

I’m getting ‘Access denied for user … Using password:YES …
Mysql::Error’ message. The OS is Solaris 5.9, Ruby is 1.8.6 and Rails
is 1.2.3. AFAIK these are all fairly new adn shouldn’t suffer from the
‘old password’ effect - even so , I have forced the password to be ‘old
style’ to be on the safe side. The database.yml looks OK to me

development:
adapter: mysql
database: mydatabase1_development
username: tobyr
password: mypassword
#socket: /tmp/mysql.sock
host: localhost
port: 3406

(I’ve tried with ‘socket’ instead of port, with the same result)

I know the username and password are right because I can use them to get
into mysql from the CLI.

Any ideas?

thanks!

Is this because of the permission set up on the mysql?
i.e. certain users or groups have certain permissions from certain
machines, ip-addresses.

On Nov 9, 8:52 am, Toby R. [email protected]

Thanks for the reply -
What identify does Ruby use when accessing mysql? For example, from the
command line I can run

~toby/rails/mydatabase#mysql -u tobyr -p
Password:

but if I run (from the same command line prompt)
~toby/rails/mydatabase#ruby my-test-script.sh

[email protected] wrote:

Is this because of the permission set up on the mysql?
i.e. certain users or groups have certain permissions from certain
machines, ip-addresses.

On Nov 9, 8:52 am, Toby R. [email protected]

The standard mysql port is 3306, not 3406. Do you have mysql running on
a different port? If not, change database.yml to

development:
adapter: mysql
database: mydatabase1_development
username: tobyr
password: mypassword
#socket: /tmp/mysql.sock
host: localhost
port: 3306 # <- port 3306

-Bill

Toby R. wrote:

password: mypassword

thanks!


Sincerely,

William P.

Sorry, I should have made that clearer - there are two instances of
mysql running and the one I want is on 3406. In fact, is there any
possibility this line is being ignored and port 3306 is being used,
because if I change ‘port’ to some random number (1234) I get the same
error message (‘Access denied’)? I’m confident I’m editing the right
section of datanbase.yml because if I change, say, the username then I
see the new username reflected in the error message I get.

William P. wrote:

The standard mysql port is 3306, not 3406. Do you have mysql running on
a different port? If not, change database.yml to

development:
adapter: mysql
database: mydatabase1_development
username: tobyr
password: mypassword
#socket: /tmp/mysql.sock
host: localhost
port: 3306 # <- port 3306

-Bill

Toby R. wrote:

password: mypassword

thanks!


Sincerely,

William P.

Fixed it! The problem was related to the two instances of Mysql. I
wanted to connect to the instance on the non-standard port (3406). I
correctly added the ‘port: 3406’ line to database.yml, but I left ‘host:
localhost’. However, as implied at
http://www.kitebird.com/articles/ruby-mysql.html#TOC_12 ‘localhost’ is
relevant to the Unix socket, not a TCP/IP connection. So, strange as it
may seem, replacing ‘localhost’ with the Fully Qualified Domain Name
fixed the problem.