WordPress全账号无法登录,数据库可见用户但验证失败技术求助
Hey there, let's work through this frustrating login issue you're stuck with. Since you already have access to phpMyAdmin, we can focus on database-level fixes and common pitfalls that cause these "invalid username/email" errors—even when users clearly exist in the wp_users table.
1. Fix the Password Hash (Critical Step!)
WordPress stores passwords as hashed strings, not plain text. If you just typed a plain password into the user_pass field in wp_users, that's why your login attempts are failing. Here's how to fix it properly:
- Open phpMyAdmin, navigate to your
wp_userstable - Find your user row and click "Edit"
- For the
user_passfield:- Select
MD5from the "Function" dropdown (this is a legacy but reliable method for quick testing; for production, generate a proper WordPress password hash using a tiny local PHP script:echo wp_hash_password('your-new-password');) - Type your desired plain password into the value box next to the MD5 function
- Select
- Save the changes, then try logging in again
2. Double-Check Database Connection & Table Prefix
Even though you can see the wp_users table, it's worth confirming WordPress is pointing to the right database resources:
- Access your site's files via FTP or cPanel File Manager, open
wp-config.php - Verify these values match your actual database details:
DB_NAME: Exact name of your WordPress databaseDB_USER: Database user with full permissions to this DBDB_PASSWORD: Correct password for that database user$table_prefix: Ensure this matches the prefix of your user tables (e.g., if your table ismywp_users, the prefix should bemywp_)
3. Validate User Account Status
A disabled or malformed user entry can block logins silently:
- In phpMyAdmin's
wp_userstable, check theuser_statuscolumn for your user—it must be set to0(a value of1means the account is disabled) - Scan the
user_loginanduser_emailfields for extra spaces, typos, or special characters that might break matching during login/reset - Confirm the
user_registereddate is a valid timestamp (not empty or garbled)
4. Rule Out Cache & Plugin Conflicts
Cached data or misbehaving plugins can interfere with login logic:
- If you can access your site's
wp-content/pluginsfolder, rename it toplugins-disabledto temporarily turn off all plugins - Clear server-side caching (like Redis, Memcached, or your host's built-in cache) and your browser's cache
- Try logging in or resetting your password again after these steps
5. Fix Password Reset Email Matching
If resetting via email still fails, ensure WordPress can properly match your email to your account:
- In phpMyAdmin, run this SQL query (replace placeholders with your actual details):
If this returns your user row, copy-paste the exact username/email from the query when requesting a password reset—typos (even subtle ones like extra spaces) are a common culprit hereSELECT * FROM wp_users WHERE user_email = 'your-email@example.com' OR user_login = 'your-username';
内容的提问来源于stack exchange,提问作者Clas Östman

