Can’t select database | WordPress.org

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?

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.

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

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 🙁

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/

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.

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

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?

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

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

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’.

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]

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?

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.

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!!!!!



Source link