• Resolved todayisfuture

    (@todayisfuture)


    Please help me!
    I can’t login my website (in my localhost) because:

    Can’t select database
    We were able to connect to the database server (which means your username and password is okay) but not able to select the NGAYMAI database.

    Are you sure it exists?
    Does the user NGAYMAI have permission to use the NGAYMAI database?
    On some systems the name of your database is prefixed with your username, so it would be like username_NGAYMAI. Could that be the problem?
    If you don’t know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

    please tell me what should i do?

    • This topic was modified 3 years, 8 months ago by todayisfuture.
Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Check your wp-config.php file and make sure that the user specified there has access to the database tables.

    Get the value of DBNAME, DB_USER and DB_PASSWORD and try the following SQL, subsituting the values here:

    GRANT ALL on DBNAME.* to 'DB_USER'@'localhost' identified by 'DB_PASSWORD';

    By the way, did this ever work or is this a new install?

    Thread Starter todayisfuture

    (@todayisfuture)

    My website is a new and didn’t ever work. I going to creating some post and make it good before work. And now I can’t connect it.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What tool(s) are you using to run your site on localhost?

    Thread Starter todayisfuture

    (@todayisfuture)

    I use Xampp.
    I checked my wp-config and there is no change. but in phpmyadmin/mysql/db don’t have my name web in table. but if I create a new web, it’s available 🙁

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I’ve never used XAMPP, I prefer https://localwp.com for quick, local sites.

    I’d start over, following https://www.wpbeginner.com/wp-tutorials/how-to-create-a-local-wordpress-site-using-xampp/

    Thread Starter todayisfuture

    (@todayisfuture)

    I’m very sad. I made my web so beatiful, many post, take many time and my mind. this is terrible! 🙁 I plan to get it working recently. I don’t know what should i do.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    That doesn’t tally with “My website is a new and didn’t ever work.”

    Thread Starter todayisfuture

    (@todayisfuture)

    Yes, it’s my fault. I took a long time preparing to put it online, I just wanted to prepare it better before going to work. I have 2 sites created together on localhost, and now both have failed. Do I have to again start?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    So they did work at one point? If so, what did you change that might have broken it?

    Thread Starter todayisfuture

    (@todayisfuture)

    No, i didn’t anything, i just only post and posts, 2-4 post/day. Morning is normal, afternoon is Error establishing a database connection

    • This reply was modified 3 years, 8 months ago by todayisfuture.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Can you get into PHPMYADMIN? If so, create a new user for the database and then use that in wp-config.php:

    GRANT ALL on DB_NAME.* to ‘newuser’@’localhost’ identified by ‘password’;

    Update wp-config to whatever you use for ‘newuser’ and ‘password’.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Also, double check the $table_prefix in wp-config.php and make sure it matches the start of the names of all of your database tables.

    [going out for a walk now… back in a couple of hours]

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I checked my wp-config and there is no change. but in phpmyadmin/mysql/db don’t have my name web in table. but if I create a new web, it’s available 🙁

    Can you explain what this means? What do you see in phpmyadmin?

    Moderator bcworkz

    (@bcworkz)

    In XAMPP, access phpMyAdmin through the MySQL “Admin” button. Locate your DB in the left column and click on it. In the privileges tab, find the user defined in wp-config.php, follow its edit privileges link, then click the “Database” button, then edit privileges link again. Grant all privileges, click go.

    Use your browser’s back button, then edit privileges for the user in wp-config.php yet again. Click Change Password button and set the password to that in wp-config.php. Click go. If the other DB credentials are correct in wp-config.php, WP should be able to connect.

    Thread Starter todayisfuture

    (@todayisfuture)

    oh my god, i went to bed, it’s 0:30 AM in here, and i can’t sleep, i awake and edit privileges same you said. and now, i can sign in my web. thank you so much!!!!!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Can’t select database’ is closed to new replies.