Forum Moderators: coopster

Message Too Old, No Replies

MySQL Error 1045: Access denied for user...

Running a server and MySQL locally on NT 2k

         

FleaPit

8:50 am on Aug 29, 2003 (gmt 0)

10+ Year Member



Ok, I am getting well miffed with this one. I have set up a server on my local PC (Win NT 2k Pro) and also MySQL. Everything installed just fine. I have created an sql user and password which shows in my.ini and I have also created a database and table no probs. However, when I try to run my PHP script I get the:

Warning: MySQL Connection Failed: Access denied for user: 'fleapit@localhost' (Using password: YES) in C:\httpd\HTDOCS\Scripts\index.php on line 3
I cannot connect to the database because: Access denied for user: 'fleapit@localhost' (Using password: YES)

I have tried to GRANT ALL PRIVILEGES ON *.* TO fleapit@localhost IDENTIFIED BY 'password'; from the command line but get the following error:

ERROR 1045: Access denied for user: '@localhost' (Using password: NO)

What am I doing wrong? I am sure I have missed something but I this is my first stab at this and I cannot see the wood for the trees!

Please help....

Fischerlaender

10:31 am on Aug 29, 2003 (gmt 0)

10+ Year Member



Did you try to login with
mysql -u root
and then execute your GRANT ALL command?

MySQL users are stored in the MySQL table 'user' in the database called 'mysql'. In my.ini you just can tell a client what login he could use, but this login must be defined in the various priviliges tables in the database 'mysql'.

FleaPit

12:00 pm on Aug 29, 2003 (gmt 0)

10+ Year Member



Where's that pulling hair out emoticon?! I run mysql monitor through the command line. Have crated a database and table no problem. But I can't get the permission to access it! What's this all about? I setup the username and password when I installed mysql, these are in my PHP script why can't it connect?!

Geees, it's only midday but I need a drink...

Fischerlaender

12:23 pm on Aug 29, 2003 (gmt 0)

10+ Year Member



How were you logged in as you created your database? What datasets do the tables in your 'mysql' database contain?

lorax

1:26 pm on Aug 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What user "owns" the database? Admin?

FleaPit

2:46 pm on Aug 29, 2003 (gmt 0)

10+ Year Member



Well I have got it to work! Twisted logic in my mind but I have now removed the username and password from my script and 'hey presto' it connects to MySQL and works like a charm!

I don't understand it and right now I don't care to understand because it works and thats all that matters... pheeeeeeeeew

Thanks for all your attempts at helping a complete idiot!