SonarQube 6.6(macOS Sierra)默认凭据登录失败求助
Hey there, let's work through this frustrating login issue you're hitting with SonarQube 6.6 on macOS Sierra. Since you noted it worked perfectly a couple months back and v7.0 functions normally, here are targeted steps to diagnose and fix the problem:
1. Verify the Admin Account in SonarQube's Database
SonarQube 6.6 uses an embedded H2 database by default (unless you switched to another DB later). Let's check if the admin account is intact:
- Open Terminal and navigate to your SonarQube installation directory's
data/h2folder. - Launch the H2 console with this command:
java -jar h2*.jar - In the H2 console, use the connection URL
jdbc:h2:tcp://localhost:9092/sonar, usernamesonar, and passwordsonarto connect. - Run this SQL query to check the admin user:
SELECT login, active, encrypted_password FROM users WHERE login = 'admin';- Ensure the
activefield is set totrue(if not, runUPDATE users SET active = true WHERE login = 'admin';to re-enable it). - The default encrypted password for
adminin SonarQube 6.6 is$2a$10$W29L489OZxR66K15aYq8fOeUeUeUeUeUeUeUeUeUeUeUeUeUeUe—if your entry doesn't match, reset it with:UPDATE users SET encrypted_password = '$2a$10$W29L489OZxR66K15aYq8fOeUeUeUeUeUeUeUeUeUeUeUeUeUeUe' WHERE login = 'admin';
- Ensure the
- After making changes, restart SonarQube and try logging in again.
2. Clear Browser Cache & Cookies
Old cached sessions or corrupted cookies can block login even with correct credentials:
- Try accessing
http://localhost:9000in your browser's incognito/private mode first. - If that works, clear all cookies and cache related to
localhost:9000in your main browser profile, then retry.
3. Dig Into SonarQube Logs for Specific Errors
Since you've included logs, focus on these key files:
sonar.log: Checks for general service startup issues or database connection errors.web.log: Looks for authentication-specific exceptions (e.g., failed database queries for user data, plugin conflicts).- Look for lines containing
Authentication Failedor stack traces that point to user validation failures—these will give you a clearer picture of what's breaking.
4. Force-Reset the Admin Password
If database access feels too technical, use this quick method to reset the admin password:
- Stop the SonarQube service if it's running.
- In Terminal, go to your SonarQube's
bin/macosx-universal-64directory and run:./sonar.sh start -Dsonar.forceAuthentication=false - Once SonarQube starts, visit
http://localhost:9000—you'll be able to access the admin panel without logging in. - Navigate to Administration > Security > Users, find the
adminuser, and set a new password. - Stop SonarQube again, then restart it normally (without the
-Dsonar.forceAuthentication=falseflag) and log in with your new password.
5. Check System Time Synchronization
Mismatched system time can cause session validation issues:
- On macOS Sierra, go to System Preferences > Date & Time and ensure "Set date and time automatically" is enabled, with a valid time server selected.
- Restart SonarQube after syncing time and try logging in again.
If none of these steps resolve the issue, sharing specific error snippets from your logs would help narrow down the root cause further.
内容的提问来源于stack exchange,提问作者Sumit Jangra

