Overview
This guide helps you set up remote MySQL access in Webuzo, enabling you to connect to a MySQL server located elsewhere instead of being limited to a local server. This flexibility is crucial for scenarios where your MySQL server is on a different machine, offering adaptability for diverse applications and development needs.
Requirements
- Reachable Remote MySQL Server
Ensure your Webuzo server can connect to the remote MySQL server.
You can run the following command to check connection
ping REMOTE_MYSQL_SERVER_IPReplace REMOTE_MYSQL_SERVER_IP with the remote MySQL server's IP or hostname.
- MySQL Services Installed and Running:
Verify that MySQL services are installed and running on your remote MySQL server.
sudo service mysql status # Check on remote serverProcedure
Remove bind-address (if set) in my.cnf:
If the bind-address is set in the MySQL configuration file (my.cnf), you may need to remove or comment it out. Open the file with a text editor:
sudo vi /etc/mysql/my.cnfOr
sudo vi /etc/my.cnfLook for a line like:
bind-address = 127.0.0.1Comment it out by adding a # at the beginning of the line:
# bind-address = 127.0.0.1Save the file and exit the text editor.
Update MySQL user host and grant privileges (on the Remote MySQL Server)
Run the following commands on your remote MySQL server:
-- Check if the user exists; create if not
CREATE USER IF NOT EXISTS 'USERNAME'@'%' IDENTIFIED BY 'NEW_PASSWORD';
-- Update MySQL user host
UPDATE mysql.user SET Host='%' WHERE User='USERNAME' AND Host='';
-- Grant all privileges with grant option
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' WITH GRANT OPTION;
-- Flush privileges to apply changes
FLUSH PRIVILEGES;
-- Exit MySQL prompt
EXIT;Replace REMOTE_MYSQL_SERVER_IP with the actual IP address or hostname of your remote MySQL server, 'USERNAME' with the MySQL username, and 'NEW_PASSWORD' with the desired password.
Setup remote MySQL settings from Webuzo Admin panel
Open MySQL Settings wizard from Webuzo Admin Panel.
Navigate to Webuzo Admin Panel > Database services > MySQL settings
Fill the required fields and click on Save settings
After that the MySQL remote connection will be set successfully.