ERROR 1146 (42S02) at line 2: Table 'librenms.alert_map' doesn't exist

Pretty old thread, but I hit this today, too.

ERROR 1146 (42S02) at line 2: Table ‘librenms.alert_map’ doesn’t exist

This was in response to the table-specific error message from this thread (the second error listed in the solution post). It may have been related to my installation being very stale (daily.sh hadn’t run in months). Looking at the 171.sql file it’s making the collate changes on all the tables, so there should be no harm in bypassing any that don’t exist. For anyone else down the road, here’s what worked for me to eliminate the error.

  1. Copy /opt/librenms/sql-schema/171.sql to my home directory.
  2. Remove the 2 lines referring to the alert_map table, since my librenms db didn’t have that table.
  3. Repeat the mysql command, this time passing it the ~/171.sql copy of the file.
  4. Repeat 2 & 3 for any other missing tables.

Once it ran without errors I was able to validate.php without a problem.

I think for the error reported by OP on this thread (database-level error, rather than table-level), the first command in that other thread should be all that is needed:

echo 'ALTER DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;' | mysql -p -u librenms librenms