Connecting WHMCS to the XUI database involves creating a user, granting permissions, and configuring the server in WHMCS. This comprehensive guide will walk you through each step to ensure a seamless connection.
Step 1: Create a User for the XUI Database
First, you need to create a user in the XUI database. Open your MySQL or MariaDB command line and run the following command:
CREATE USER 'shahid_xui'@'101.522.12.103' IDENTIFIED BY 'mypass121';
'shahid_xui'
is the username you are creating.101.522.12.103
is the IP address of your WHMCS server.'mypass121'
is a strong password you have chosen.
Step 2: Grant Permissions to the User
Next, grant the necessary permissions to the newly created user by running the following command:
GRANT SELECT, INSERT, UPDATE, DELETE ON xui.* TO 'shahid_xui'@'101.522.12.103' WITH GRANT OPTION;
- Ensure that
'shahid_xui'
matches the username you created. 101.522.12.103
should be the actual IP address of your WHMCS server.
Step 3: Apply the Privileges
After granting the permissions, apply the changes by running:
FLUSH PRIVILEGES;
This command ensures that all changes take effect immediately.
Step 4: Configure WHMCS to Connect to XUI Database
- Log in to WHMCS Admin Panel: Access your WHMCS admin area.
- Navigate to Servers:
- Go to Setup > Products/Services > Servers.
- Add or Edit a Server:
- Click Add New Server or select an existing server to edit.
- Enter Server Details:
- Hostname/IP Address: Enter the IP address of the XUI server.
- Module: Select XUIone from the dropdown menu.
- Username: Enter the username you created earlier (
shahid_xui
). - Password: Enter the password you set (
mypass121
).
- Save Configuration: Ensure all details are correct and click Save Changes.
Important Notes
- Replace Placeholders: Ensure to replace all placeholders (e.g.,
'101.522.12.103'
,'mypass121'
) with your actual data. - Network Configuration: Make sure your database server is configured to accept connections from the IP address of your WHMCS server.
- Firewall Settings: Verify that there are no firewall rules blocking the connection.
By following these steps carefully, you will establish a successful connection between WHMCS and the XUI database. If you encounter any issues, double-check the details and ensure there are no network restrictions.