MySQL Connect Error

  • yomi
  • Student
  • Student
  • User avatar
  • Joined: Apr 02, 2008
  • Posts: 92
  • Loc: Nigeria
  • Status: Offline

Post April 2nd, 2008, 4:59 am

Error connecting to databasePHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\Inetpub\wwwroot\hr\idea_dcsn.php on line 127

i seem to have correctly fulfilled my part in correctly putting variables. my code works fine testing remotely but on the server, its bonkers. on my local machine i use EASYPHP(php, apache,mysql) but on the server, i am using iis,mysql,php.

please help!!!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 2nd, 2008, 4:59 am

  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2206
  • Loc: Canada
  • Status: Offline

Post April 2nd, 2008, 7:29 am

Are you sure you've
  • Correctly inserted the right variables to your connect statement
  • Are using the right user name - some put the account before (ex account_user)
  • Given privileges to the user in question

If you're not using a password, I highly recommend one.
  • yomi
  • Student
  • Student
  • User avatar
  • Joined: Apr 02, 2008
  • Posts: 92
  • Loc: Nigeria
  • Status: Offline

Post April 3rd, 2008, 8:25 am

neksus wrote:
Are you sure you've
  • Correctly inserted the right variables to your connect statement
  • Are using the right user name - some put the account before (ex account_user)
  • Given privileges to the user in question

If you're not using a password, I highly recommend one.

thanks, i forgot to put the right password on my pages, done that yesterday but today, i have this challenge

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line

i had to enter the cmd env to test my query cos my php pages were just working like links. i know my php is ok cos i call pages with functions. i can select from my db tables but cant update or insert.
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post April 3rd, 2008, 8:55 pm

Your user should be changed accordingly. If you are still using 'localhost' change it to the real host, unless you are using something and need to change your host to localhost. Also, make sure your user is correct. On default settings, the user is mainly "root" but it could be changed, so make sure you got the right user as well.
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • cjxxi
  • Expert
  • Expert
  • No Avatar
  • Joined: Aug 02, 2004
  • Posts: 548
  • Loc: Fort Worth, TX
  • Status: Offline

Post April 4th, 2008, 1:08 am

Error connecting to databasePHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\Inetpub\wwwroot\hr\idea_dcsn.php on line 127

that error looks like the user is there but the table doesnt havet permission for that user.



ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line

and this one looks like a sintax error in your query
networklatino.com
-----------------------------------
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post April 4th, 2008, 6:39 am

than the password is incorrect I assume
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • cjxxi
  • Expert
  • Expert
  • No Avatar
  • Joined: Aug 02, 2004
  • Posts: 548
  • Loc: Fort Worth, TX
  • Status: Offline

Post April 4th, 2008, 12:13 pm

Bogey wrote:
than the password is incorrect I assume

no, you just need to assign the right privileges to that user. has nothing todo with the password, although onces you have assigned right permission to the user, you can also reset the password, and that seems to fix this kind of conflicts
networklatino.com
-----------------------------------
  • cjxxi
  • Expert
  • Expert
  • No Avatar
  • Joined: Aug 02, 2004
  • Posts: 548
  • Loc: Fort Worth, TX
  • Status: Offline

Post April 4th, 2008, 12:16 pm

yomi wrote:
neksus wrote:
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line


also, at the time you get this error, it seems that the user is already connected to the database. so it starts being a minor sintax error and not a database wide problem.
networklatino.com
-----------------------------------
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2206
  • Loc: Canada
  • Status: Offline

Post April 4th, 2008, 12:20 pm

I didn't say that :P lol
  • cjxxi
  • Expert
  • Expert
  • No Avatar
  • Joined: Aug 02, 2004
  • Posts: 548
  • Loc: Fort Worth, TX
  • Status: Offline

Post April 4th, 2008, 12:23 pm

neksus wrote:
I didn't say that :P lol


you didn't say what now? :( I am a bit confused :lol:
networklatino.com
-----------------------------------
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2206
  • Loc: Canada
  • Status: Offline

Post April 4th, 2008, 12:42 pm

What you quoted me as saying lol
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post April 4th, 2008, 1:28 pm

cjxxi wrote:
Error connecting to databasePHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\Inetpub\wwwroot\hr\idea_dcsn.php on line 127

that error looks like the user is there but the table doesnt havet permission for that user.



ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line


and this one looks like a sintax error in your query


cjxxi said that not neksus
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post April 4th, 2008, 1:30 pm

cjxxi wrote:
Bogey wrote:
than the password is incorrect I assume

no, you just need to assign the right privileges to that user. has nothing todo with the password, although onces you have assigned right permission to the user, you can also reset the password, and that seems to fix this kind of conflicts

Quote:
Error connecting to databasePHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\Inetpub\wwwroot\hr\idea_dcsn.php on line 127

So, there is no password for the user?
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • cjxxi
  • Expert
  • Expert
  • No Avatar
  • Joined: Aug 02, 2004
  • Posts: 548
  • Loc: Fort Worth, TX
  • Status: Offline

Post April 4th, 2008, 2:25 pm

Bogey wrote:
So, there is no password for the user?


regardless of weather there is a password or not or even if is correct or not, that specific user must have permissions to access that table. usually if it is root, will have that special permission by default. otherwise it needs to be set manually.
networklatino.com
-----------------------------------
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post April 4th, 2008, 3:21 pm

If there is no password, than that user can't even log in can it? A permissionless user should be able to log in to MySQL database but wouldn't be able to do anything.

The way I see it is if you are a user registered to a forum, but you will never NEVER NEVER see a warning saying you can't access anything as a user if you have forgotten the password.

That's the way I see it though... :lol:
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 4th, 2008, 3:21 pm

Post Information

  • Total Posts in this topic: 34 posts
  • Users browsing this forum: No registered users and 160 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.