Prepare MySQL database configuration
In this milestone, you prepare the MySQL database configuration required for monitoring. This includes creating a dedicated monitoring user account with the necessary permissions and gathering the connection details needed for Grafana.
Creating a dedicated monitoring user with minimal required privileges follows security best practices and ensures that the monitoring system has only the access it needs to collect metrics and logs.
Prerequisites:
- Check if the MySQL server is up and running.
- Make sure that your firewall is open for MySQL server (default port is
3306).
To prepare your MySQL database configuration, complete the following steps:
Connect to your MySQL server as an administrative user:
mysql -u root -pCreate a dedicated monitoring user for Grafana.:
CREATE USER 'grafanaReader' IDENTIFIED BY 'password';Grant the necessary privileges for monitoring:
GRANT SELECT ON performance_schema.* TO 'grafanaReader';Exit the MySQL client:
EXIT;Test the monitoring user connection:
mysql -u grafanaReader -p -e "SHOW STATUS LIKE 'Uptime';"
In the next milestone, you’ll add the MySQL data source to your Grafana Cloud instance.
At this point in your journey, you can explore the following paths:
