CloudStack管理服务启动失败:merovingian2无法获取新数据库连接
Hey there, let’s break down how to fix this frustrating database connection error step by step—this is a common snag when setting up CloudStack, so we’ll start with the most likely culprits:
1. Verify CloudStack Database Configuration
First, double-check the core database settings that CloudStack relies on:
- Locate the config file at
/etc/cloudstack/management/db.properties - Confirm these critical values are correct:
jdbc.url: Ensure it points to your database host, port, and the CloudStack database name (e.g.,jdbc:mysql://your-db-host:3306/cloud?useSSL=false&serverTimezone=UTC). If your database is on the same management server,localhostshould work—don’t accidentally use server2’s IP here!jdbc.userandjdbc.password: These must match the credentials you created specifically for CloudStack. Typos here are one of the top causes of this error.jdbc.driverClassName: For MySQL 5.x, usecom.mysql.jdbc.Driver; for MySQL 8.0+/MariaDB 10.2+, switch tocom.mysql.cj.jdbc.Driver(CloudStack 4.11 works best with the older driver, so confirm your database version matches).
2. Test Direct Database Connectivity
Let’s rule out database-side issues by connecting directly from your management server (server1):
Run this command in your terminal:
mysql -u <cloud-db-user> -p<cloud-db-password> -h <db-host> cloud
- If this fails, your problem isn’t with CloudStack—it’s with the database itself:
- Check if MySQL/MariaDB is running (
service mysqld statusorsystemctl status mariadb). - Verify port 3306 is open on the database server (use
telnet <db-host> 3306ornc -zv <db-host> 3306to test connectivity). - Make sure the database server’s firewall isn’t blocking incoming traffic from server1.
- Check if MySQL/MariaDB is running (
3. Confirm Database User Permissions
CloudStack’s database user needs explicit permission to connect from server1:
- If you restricted the user to
localhostduring setup, but CloudStack tries to connect via the server’s private/public IP, it will fail. Fix this by re-granting permissions:
GRANT ALL PRIVILEGES ON cloud.* TO '<cloud-db-user>'@'<server1-ip>' IDENTIFIED BY '<cloud-db-password>'; FLUSH PRIVILEGES;
- For testing, you can temporarily use
'%'instead of<server1-ip>to allow connections from any host (just remember to lock this down for production!).
4. Dig into Management Server Logs for Specific Details
The error message you’re seeing is generic—let’s get the full story from the logs:
- Open the management server log at
/var/log/cloudstack/management/management-server.log - Search for keywords like
merovingian2,SQLException, orconnection refused. You’ll find specific errors that point to the root cause, such as:Access denied for user 'clouduser'@'server1': Permissions issueCould not connect to host: 192.168.x.x: Network/firewall blockUnknown database 'cloud': You didn’t initialize the CloudStack database correctly
5. Double-Check CloudStack Setup Steps
Quickly confirm you didn’t miss a key setup step:
- Ensure you ran
cloudstack-setup-databasesto initialize the database schema and permissions (this is easy to skip if you’re following the guide too quickly). - Verify the NFS share for secondary storage is configured correctly (while this doesn’t directly cause database errors, it’s a common post-install misstep that can cascade into other issues).
Once you fix the underlying database connection issue, re-run cloudstack-setup-management and start the service with service cloudstack-management start—it should fire up successfully if the connection is working.
内容的提问来源于stack exchange,提问作者JackFrost

