Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

Post-plugin actions are needed - The fix

CronoBandit

Newbie
Joined
Jan 3, 2020
Messages
1
Literally immediately after installing the ZoneMinder v1.32.3 plugin on my FreeNAS v11.2 system, I pointed my browser to the new jail's IP and got the following error:

Unable to connect to ZM db.SQLSTATE[HY000] [1045] Access denied for user 'dbadmin'@'localhost' (using password: YES)

FreeNAS plugins are great, but I wasn't able to readily find what I would refer to as "post-plugin actions" guide -- call me a newb here... oh well, let's do it the hard way...

So, a quick check inside the jail's mysql server revealed there was no such 'ZM' database, which means... yup, no 'dbadmin' user inside of that.

Note: I see some past posts/docs reference 'zmuser', no idea why the plugin was built with 'dbadmin', yet it's the same concept ... a user account is required by the web interface.

The fix overview --> setup/create the database, create the database user/password, and finally update zoneminder's web config to match THAT password we've chosen.

Ready ?? Here we go ...

ssh or console into FreeNAS, and escalate to root:

su -

Call-up a listing of your installed jails, and note the zoneminder jail ID number:

jls

JID IP Address Hostname Path
2 192.168.1.8 zoneminder /mnt/rpool/iocage/jails/zoneminder/root


Okay, so mine is at 2. Yours could be different.
Now login to the jail's (zoneminder) OS console with your number:

jexec 2 csh

So the plugin install process did not create the zoneminder baseline database.
Luckily there is a app script for that :

mysql -uroot -p < /usr/local/share/zoneminder/db/zm_create.sql

Just hit enter when mysql asks for root's password, as the plugin's jail has it likely blanked.
This might take a second or two - be patient...

Prompt is back... Okay, now you must create the missing mysql user account :

mysql -uroot -p -e "grant lock tables,alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on zm.* to 'dbadmin'@localhost identified by '_pick_a_password_here_';"

Take note, we are acting on 'dbadmin' user, and to choose a unique password, in-place of "_pick_a_password_here_".

Finally, we must tell the web interface this password we set.
The 'zm.conf' file contains the password setting, however instead of editing that file (they urge you don't), we will create an override setting file.

cd /usr/local/etc/zoneminder
ee 88-custom-zm.conf


Inside the editor, add the following 2 lines:

# ZoneMinder database password
ZM_DB_PASS=_pick_a_password_here_


Again, use the password you chose in the above "identified by" statement.
'ESC' to exit, save the file.

Let's retry now ... no need to restart anything, just re-browse to the jail's web IP and the ZM interface so load now.
'exit' out of the jail and console sessions.

That's it! Hope this helps anyone else that is new to ZM & FreeNAS.
 

Nitro626

Member
Joined
Mar 4, 2019
Messages
27
Very Strange i just got this error:-
Unable to connect to ZM db.SQLSTATE[HY000] [1045] Access denied for user 'zmuser'@'localhost' (using password: YES)
and
Code:
mysql -uroot -p < /usr/local/share/zoneminder/db/zm_create.sql


Returns
Access denied for user 'root'@'localhost' (using password: NO) with or with out root Pword
 
Top