Errors and Could not connect to the database

Discussion in 'Databases' started by DMK, Jan 4, 2011.

  1. #1
    I'm seeing couple of errors and a 'could not connect to the database' error on one of my website. Here's is the exact error
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbname'@'208.109.78.142' (using password: YES) in /home/content/forum/db/mysql4.php on line 48
    
    Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/content/forum/db/mysql4.php on line 330
    
    Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/content/forum/db/mysql4.php on line 331
    phpBB : Critical Error
    
    Could not connect to the database
    Code (markup):
    I have'nt changed anything except added a new mysql db few days before the error popped up. I also uploaded the php file from my harddisk to overwrite the error file but that did'nt solve the problem either.

    If anyone can help me with this please.
     
    DMK, Jan 4, 2011 IP
  2. loungebiz

    loungebiz Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, i'm not very familiar with MySql. But base on my experience using mssql, in your cases, base on the error message, it seem that your mysql user account doesn't has any access to your db. Should you check you DB permission for your user account.

    Just my opinion, maybe should ask someone more expert in Mysql.
     
    loungebiz, Jan 4, 2011 IP
  3. emailboy

    emailboy Banned

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #3
    If everything seems to be very right, then the problem maybe because of long password. Keep the password under 15 characters and it will work just fine.

    Hope that helps.
     
    emailboy, Jan 6, 2011 IP
  4. emailboy

    emailboy Banned

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Once again, that is only if everything seems to be very right. I am not recalling other things, as I code in many languages so its something silly but just off of my head. Hope you solve it soon. Best of luck :)
     
    emailboy, Jan 6, 2011 IP
  5. aboxy

    aboxy Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    it basically means that user does not have access, may be because of wrong password or user does not exist.
    Did you create a user 'dbname'@'%'?
     
    aboxy, Jan 10, 2011 IP
  6. DMK

    DMK Active Member

    Messages:
    585
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thanks for the replies guys but I still can't solve the issue. Even if I can connect to the db means I need input the username/password somewhere, right? But I can't find where to do that, what file to edit? I replaced the files giving me error but still no luck. The forum was running on phpbb2.
    @aboxy, no I never created a 'dbname'@'%'.
     
    DMK, Jan 10, 2011 IP
  7. aboxy

    aboxy Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    aboxy, Jan 10, 2011 IP
  8. mickster

    mickster Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    MYSQL is not like SQL; you do not connect through a GUI (like SQL Server Management Studio). All your commands are run from a terminal session.

    With your site, the db password and login would have been set when it was first installed. If no one can remember the password, you can connect to the MYSQL db with the root password (if you have that handy).

    If you're lucky, when the database was first installed no one set the root password (the MYSQL root password is blank by default) and you can easily login as root without a password.

    Once logged in, the following command will list the available databases on the MYSQL server:

    If you get this far you should be able to readily make out the database that your site is using. Once you have that it will be easier to look at logins for that database.

    However, if you cannot remember any password including the root password (and no one can) you're best off reinstalling your entire site.
     
    mickster, Jan 14, 2011 IP
  9. DMK

    DMK Active Member

    Messages:
    585
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    60
    #9
    Thanks for the suggestions guys. I tried my best but could not get it working. I also found malicious code on some pages which means the site and db was probably hacked. I had to take the site down, will start fresh again.
     
    DMK, Jan 14, 2011 IP
  10. Litonice09

    Litonice09 Well-Known Member

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    Digital Goods:
    1
    #10
    Remember if your computer is affected by virus then it'll not work properly in sql server to connect database.
     
    Litonice09, Jan 17, 2011 IP
  11. aboxy

    aboxy Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Are you serious dude? Don't comment unless you know what you are talking about.
    There is a problem in hand and let's not confuse the OP further. BTW, DB is mysql and not sql server
     
    aboxy, Jan 17, 2011 IP
  12. Litonice09

    Litonice09 Well-Known Member

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    Digital Goods:
    1
    #12
    i faced some problem like this that's why i replied this thread that's all.
     
    Litonice09, Jan 17, 2011 IP
  13. Backlinkshub

    Backlinkshub Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    There may be two possibilities :

    1) Either your MySQL service is not started properly so just check the services (If you are working on local computer either ask your Hosting Provider about your problem.)

    OR

    2) Your user that you are using not having enough permission to access that DB
    Chek the user permission from your cPanel.
     
    Backlinkshub, Feb 3, 2011 IP
  14. anjila

    anjila Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Hello all,I have bought a new laptop,But my Win XP and Database is not working.I tried my best but could not get it working. I also found malicious code on some pages which means the site and db was probably hacked. I had to take the site down, will start fresh again.But stil facing same problem.Please someone suggetion me.Thanks in advance.
     
    anjila, Feb 3, 2011 IP