Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Troubleshooting for a warning:[Web App from scratch series]

  • This topic is empty.
Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #133434
    __
    Participant

    Did you check your dsn string, username and password? Are they correct?

    #133447
    Nick01
    Member

    @traq
    1) Does it always give that error (can you ever connect to your DB, even PHPMyAdmin)?
    Yes,I can connect to my DB in PHPMyAdmin,but other times I am haunted by:

    Connection failed: SQLSTATE[28000] [1045] Access denied for user ‘db_user’@’localhost’ (using password: YES)

    2) How are you trying to create that database? Are you trying to import it using an sql file? Can you create a new table using the [Create table] button in PHPMyAdmin?

    Prior to your comment today, I didn’t realize I was importing a database inside database instead of tables. Do web host allow importing an entire database? Because all I can see here
    is “Create a new database option”, then your supposed to log into PHPMyadmin(where you can only import tables)

    3) I followed your step and edited my Base.php,but then this happened :
    [Warning](http://oi43.tinypic.com/34tesue.jpg “And another warning.”)
    Is my [syntax](http://oi40.tinypic.com/2koh6q.jpg “syntax”) correct ? Should the Dns field be $Linkor $Link (since all content is uploaded in site directory), either ways
    it shows the same warning.

    I really appreciarte your help.Thank you @CrocoDillon too.

    #133457
    __
    Participant

    Your earlier warning (“`Connection failed: SQLSTATE[28000] [1045] Access denied for user ‘db_user’@’localhost’ (using password: YES)`”) was being generated in that `catch` block. When you tried my new `exit` command, we found out what the problem really was: the file which defines those constants is missing (because they were missing, an exception was thrown inside the `catch` block, which results in the fatal error you saw).

    I think you need to go back to that tutorial (and/or the github page Crocodillon linked) and make sure you *have* all of the files you actually *need*. I wouldn’t be surprised if others are missing too.

    Specifically, once you get that `inc/constants.inc.php` file in place, you need to edit it so that it defines those constants with *your* DB credentials (because they’re missing, PDO is using default values, which obviously aren’t correct).

    *****
    to answer your other questions:

    > I didn’t realize I was importing a database inside database instead of tables. Do web host allow importing an entire database? Because all I can see here is “Create a new database option”, then your supposed to log into PHPMyadmin(where you can only import tables)

    I don’t know if the file you import is trying to create tables or databases. You can open it in a text editor and just read it to find out.

    If it’s creating tables, you shouldn’t have a problem as long as you’ve already selected a DB to use in PHPMyAdmin.

    If it’s creating a new database, you might (probably will) have problems, since many shared hosts don’t allow you to create new databases programmatically (they want you to do it via your CP instead).

    > I can connect to my DB in PHPMyAdmin,but other times I am haunted by:
    Connection failed: SQLSTATE[28000] [1045] Access denied for user ‘db_user’@’localhost’ (using password: YES)

    To clarify, you sometimes get that error in PHPMyAdmin?

    #133466
    Nick01
    Member

    I have updated constants.inc.php file.All the required files were present.
    I’m presented with the same error:
    Connection failed: SQLSTATE[28000] [1045] Access denied for user ‘u265831516_nick’@’localhost’ (using password: YES)

    #133477
    CrocoDillon
    Participant

    By the way, change the `include_once` to `require_once` (for the constants) so you’ll get an error there if something goes wrong.

    #133525
    Nick01
    Member

    @CrocoDillon
    Same error
    Connection failed: SQLSTATE[28000] [1045] Access denied for user ‘u265831516_nick’@’localhost’ (using password: YES)

    I get a feeling it has got something to do with the privileges granted to the user of the created database?

    #134414
    Nick01
    Member

    Thank you guys, the problem has been solved. I tried out a different web hosting service and figured out the MySQL host name.

Viewing 7 posts - 16 through 22 (of 22 total)
  • The forum ‘Back End’ is closed to new topics and replies.