You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WAMP本地部署WHMCS遇SQLSTATE[HY000][1045]数据库访问拒绝错误求助

Fixing WHMCS Database Access Denied Error (1045) on WAMP

Hey there, let's troubleshoot that annoying SQLSTATE[HY000] [1045] Access denied error you're hitting when setting up WHMCS on your local WAMP stack. This usually boils down to mismatched user credentials or permission issues, so let's walk through the fixes step by step:

1. Double-Check MySQL User Permissions in phpMyAdmin

First, let's make sure the test user has the correct setup:

  • Open phpMyAdmin from your WAMP dashboard.
  • Navigate to the User accounts tab.
  • Find the test@localhost entry and click Edit privileges.
  • In the Login Information section:
    • Confirm the password matches exactly what you're entering in WHMCS (no typos, extra spaces, or wrong case).
    • Ensure the Host name is set to localhost—MySQL treats localhost and 127.0.0.1 as separate hosts, so match this value in your WHMCS setup.
  • Scroll down to Global privileges and make sure the user has at least these WHMCS-required permissions:
    SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX
  • Click Go to save changes.

2. Restart the MySQL Service

MySQL sometimes caches old credential data, so a quick restart can clear this up:

  • Open your WAMP tray icon menu.
  • Hover over MySQL > Click Restart Service.
  • Wait 10-15 seconds for the service to reload, then try the WHMCS installation again.

3. Verify WHMCS Installation Form Inputs

It's easy to slip up with typos—double-check these fields in the WHMCS setup:

  • Database Username: Confirm it's exactly test (no accidental capitalization or spaces).
  • Database Password: Type it slowly, or copy-paste if you saved the password elsewhere (watch for special characters that might get mangled).
  • Database Host: Try localhost first; if that fails, switch to 127.0.0.1 (some WAMP configurations prioritize one over the other).

4. Test the Connection Manually (Optional)

To rule out WHMCS-specific issues, create a quick test script:

  1. In your WAMP www folder, make a new file named test_db_connection.php.
  2. Paste this code (replace your_password_here with your actual password):
    <?php
    $host = 'localhost';
    $user = 'test';
    $pass = 'your_password_here';
    
    $conn = mysqli_connect($host, $user, $pass);
    
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
    echo "Successfully connected to MySQL!";
    mysqli_close($conn);
    ?>
    
  3. Visit http://localhost/test_db_connection.php in your browser:
    • If it shows "Successfully connected", the problem is in your WHMCS form input.
    • If you still get the 1045 error, go back to step 1 to recheck the user's password and permissions.

Attached Screenshots

Installation Page: WHMCS Database Configuration Screen
Error Screen: MySQL Access Denied Error

内容的提问来源于stack exchange,提问作者Andreas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 11:57:42