Services Cannot Connect to Database - Wiki
Services Cannot Connect to Database
Errors or Symptoms #
- The management console shows an "Unhandled Exception" (applies to 2.4.X)
- The management console gives the error "Could not detect whether or not setup wizard has been run" (applies to 2.5.X)
- While installing Platform Services, it fails to update the database because "table does not exist" (applies to 2.4.X and up)
The following services do not run:
- Application Server,
- Watchdog Service,
- SFTP Server,
- Log Server,
- Stats Server
Applicable Versions #
A lot of people have been seeing these issues come up on the management after an install/reinstall of the Cisco Unified Application Environment. This admittedly unhelpful message usually indicates that the management service (and most likely all the other services) cannot successfully connect to the database. There are two basic reasons for this failure, and we will investigate possible causes for either one.
1) The database is not there or has no tables
If you access the MySQL database (like via the MySQL Command Center) using the root login, you should execute the query "SHOW DATABASES" and the database "mce" should come up in the list. If it does, access the database ("USE mce") and execute "SHOW TABLES". If the mce database isn't there or there or no tables listed in the database, then that is obviously the first problem.
The dirty secret here is that, the first time you install the Cisco Unified Application Environment on a machine, it installs the database and drops a breadcrumb in the Windows registry to indicate that the database has been installed. It does this so that when you do upgrades, it uses the breadcrumb to determine that the database is not to be reinitialized. When you uninstall the Cisco Unified Application Environment, including MySQL itself, the database files are normally left intact, thereby preserving all of your old data. The problem comes when administrators decide they want to start clean on the machine and, instead of reinstalling the OS, uninstall all of the individual software pieces. This includes MySQL, with some going as far as deleting the MySQL directory from Program Files. This is where it can go wrong.
The registry entry is still in there, so the next time the platform installer runs it will see it and decide not to initialize the database. The solution is simple. Uninstall the Cisco Unified Application Environment. Run regedit.exe, and find and delete the following key:
Once you remove that, install the Cisco Unified Application Environment again and the database should be intialized.
Clearly this case comes up fairly often and our current strategy for handling it is insufficient. We will try to address this in later versions of the installers.
2) Credentials to connect to the database are incorrect
The quick way to figure this out is to open up your cuae-common.config file (found in the install path of the Cisco Unified Application Environment) and look at your username and password. Use the username and password to try to log in to MySQL and see if you're successful. You can try this by opening up a command prompt and typing:
mysql -u <user> -p
Note there is no space between the p flag and the password. Alternatively, you can leave off the password and it will prompt you for it.
If you have been denied access, then your credentials are incorrect.
By and large, this is mostly seen on developer installs. During the install, it will ask you for two database user credentials. The first is the root MySQL user credentials to install the database, and the second is for credentials that the Cisco Unified Application Environment services themselves need to access the database. For the latter, most people simply enter in the root user's credentials again (which is suggested as a possibility in the dialog box itself). However, some people enter in a different MySQL user account and password thinking that the installer will actually create the account in MySQL. This is not the case. The account must already exist in MySQL and have permissions on the "mce" database to work. 99% of the time, this seems to be not the case.
Two ways to solve this:
- Create the MySQL user and give it the proper permissions on the "mce" database
- Just configure the services to use the MySQL root user/password. You would make this change in two files:
- c:\program files\cisco systems\unified application environment\cuae-common.config
- c:\program files\cisco systems\unified application environment\MgmtServiceLauncher\conf\production.properties
Note: If you plan to use the legacy mceadmin, you would also need to change in c:\program files\cisco systems\unified application environment\mceadmin\includes\config.php
There is also a possibility that you are trying to use "root" or a MySQL user that does exist to access the database, but you merely mistyped the password during the install. The solution is simply to correct it in the configuration files listed above.
If you see this on a production install, where the MySQL user is created and the password is generated, you should contact Cisco Technical Support so we can figure out why the configuration ended up not matching the generated credentials.