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

Good day all,
Issue that I am having is this:

Fail: MySQL Database collation is wrong: utf8mb4 utf8mb4_general_ci

I ran this as per laf:

mysql -p -u librenms librenms < /opt/librenms/sql-schema/171.sql

and this is what shows up after running that command:

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

Thanks!!

Edit: Here is my output

Component Version
LibreNMS 1.58.1-71-g17b3f8437
DB Schema 2019_12_01_165514_add_indexes_to_mpls_lsp_paths_table (152)
PHP 7.2.24-0ubuntu0.18.04.1
MySQL 10.4.11-MariaDB-1:10.4.11+maria~bionic
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.9.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] MySQL Database collation is wrong: utf8mb4 utf8mb4_general_ci
[FIX]:
Check https://t.libren.ms/-zdwk for info on how to fix.
[OK] Database schema correct
[WARN] You have not added any devices yet.
[FIX]:
You can add a device in the webui or with ./addhost.php

maybe some solution

What is the solution?

Same for me
librenms@librenms:~$ mysql -p -u librenms librenms < /opt/librenms/sql-schema/171.sql
Enter password:
ERROR 1146 (42S02) at line 2: Table ‘librenms.alert_map’ doesn’t exist
librenms@librenms:~$

Has anyone found a fix for this issue? I’m having the same issue on 1.64.1:

Component Version
LibreNMS 1.64.1
DB Schema 2020_04_19_010532_eventlog_sensor_reference_cleanup (165)
PHP 7.4.6
Python 3.6.9
MySQL 5.7.23
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.10.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] MySQL Database collation is wrong: latin1 latin1_swedish_ci
[FIX]:
Check https://t.libren.ms/-zdwk for info on how to fix.
[OK] Database schema correct
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[WARN] Your install is over 24 hours out of date, last update: Mon, 01 Jun 2020 16:24:49 +0000
[FIX]:
Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN] Your local git branch is not master, this will prevent automatic updates.
[FIX]:
You can switch back to master with git checkout master

root@librenms-0:/opt/librenms# mysql -u root -p -h mysql-aytra librenms < /opt/librenms/sql-schema/171.sql
Enter password:
ERROR 1146 (42S02) at line 2: Table ‘librenms.alert_map’ doesn’t exist

Seems as though your schema is correct (except the odd collation error)

Have you found a fix to this issue?

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