ZoneMInder database related installation and startup issue

Asked by MrCompTech

Currently using Ubuntu 16.04.3 LTS.

I experienced an effor while installing ZoneMinder according instructions at https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.30.4_the_easy_way#Install_Zoneminder_1.30.4.

The error was had something to do with user 'debian' not being able to login to mysql. I was not able to copy and paster from the error dialog box (-Select All {Ctrl-A}- was not allowed) otherwise I would post the details here. Also, the error message stated is would not send the error to Ubuntu because it had to do with ZoneMinder and not Ubuntu.

In the step in the instructions mentioned above for starting the ZoneMinder service, the service fails to start.
The command 'journalctl -xe' displays:
-- Unit zoneminder.service has begun starting up.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: Can't connect to db at /usr/share/perl5/ZoneMinder/Config.pm line 129.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 129.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: Compilation failed in require at /usr/bin/zmpkg.pl line 48.
Feb 19 13:23:48 ree-ofc-w01 zmpkg.pl[13600]: BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 48.
Feb 19 13:23:48 ree-ofc-w01 systemd[1]: zoneminder.service: Control process exited, code=exited status=255
Feb 19 13:23:48 ree-ofc-w01 systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.

The second line indicates that the zone minder database user is denied access.
I already use PhpMyAdmin to perform most maintenance on my MySQL databases.
How do I fix this issue?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu zoneminder Edit question
Assignee:
No assignee Edit question
Solved by:
MrCompTech
Solved:
Last query:
Last reply:
Revision history for this message
MrCompTech (mrcomptech) said :
#1

This issue has been solved.

For my issue I found that the database 'zm' in MySQL had been created and populated, but the user 'zmuser' had not been created.

Another problem is where else to place this password so that the service could access the database.

It turned out that the password for ZoneMinder db user zmuser is hard coded in /etc/zm/zm.conf line 47-48:
    # ZoneMinder database password
    ZM_DB_PASS=zmpass

I replaced zmpass with the randomly generated password (from passwordsgenerator-dot-net) and then through PHPMyAdmin I added user zmuser with the same password as in zm.conf and gave this user all privileges to the zm database.

The ZoneMInder service restarted without any issues:
    sudo service zoneminder start

And the web page http://localhost/zm came up with no problems.

Revision history for this message
Kevin A. (linux-lightning) said :
#2

I am having the same problem as described here, after installing ZoneMinder v1.34 on Ubuntu v20.04, according to ZoneMinder documentation here:

https://zoneminder.readthedocs.io/en/stable/installationguide/ubuntu.html#easy-way-ubuntu-18-04-bionic

I get the "Access denied" error for 'zmuser' to db 'zm', in response to 'systemctl start zoneminder' command, and this is not corrected with the steps above. I have confirmed in mysql that the database "zm" was created and populated with fields, user "zmuser" was created and granted privileges to access database "zm", and ZM_DB_PASS=zmpass in /etc/zm/zm.conf. But the error persists. I have also tried reinstalling LAMP and ZoneMinder 1.34. I am at a loss as to what else to try.

Any assistance is appreciated.