Access denied when running zmupdate.pl

Support and queries relating to all previous versions of ZoneMinder
Locked
bosskong
Posts: 25
Joined: Thu Feb 16, 2006 2:40 am

Access denied when running zmupdate.pl

Post by bosskong »

I'm trying to upgrade from 1.22.0 to 1.22.1. I ran configure and make install. Then I ran:
zmupdate.pl –version=1.22.0 [--user=zm_user --pass=zm_pass]
But I get the following error:
Warning, overriding installed ./zm.conf file with local copy
Update agent starting at 06/05/01 00:27:05

Initiating database upgrade to version 1.22.1
Please ensure that ZoneMinder is stopped on your system prior to upgrading the database.
Press enter to continue or ctrl-C to stop :

Do you wish to take a backup of your database prior to upgrading?
This may result in a large file if you have a lot of events.
Press 'y' for a backup or 'n' to continue : y
Creating backup to zm-1.22.0.dump. This may take several minutes.
mysqldump: Got error: 1044: Access denied for user 'zm_user'@'localhost' to database 'zm' when using LOCK TABLES
Output:
Command 'mysqldump -hlocalhost -uzm_user -pzm_pass --add-drop-table --databases zm > zm-1.22.0.dump' exited with status: 2
I've tried every combination I can think of, like:
zmupdate.pl –version=1.22.0 [--user=zm_user --pass=zm_pass]
zmupdate.pl –version=1.22.0 [--user=zmuser --pass=zmpass]
zmupdate.pl –version=1.22.0 --user=zm_user --pass=zm_pass
zmupdate.pl –version=1.22.0 --user=zmuser --pass=zmpass
But they all produce the same result. Any tips?
User avatar
acrid
Posts: 68
Joined: Sun Aug 24, 2003 10:26 pm
Location: Germany

Post by acrid »

did you use the correct user for the database?
looks like you just copied "zmuser" and "zmpasswd" instead of i.e. "zm_admin" and "mysecretpassword".

see /etc/zm.conf for ZM_DB_USER and ZM_DB_PASS

Code: Select all

$> man woman
$> Segmentation fault (core dumped)
bosskong
Posts: 25
Joined: Thu Feb 16, 2006 2:40 am

Post by bosskong »

I'm pretty sure that I just used the default user and password. In /usr/local/etc/zm.conf, I have the following:
---------------------
# ZoneMinder database user
ZM_DB_USER=zmuser

# ZoneMinder database password
ZM_DB_PASS=zmpass
---------------------
I don't think I changed it to anything. Everything works ok in the old version. I'm assuming that if those weren't the correct username/passwords, I'd be having problems. Is there any way to verify the correct username or to crack the password? Or am I missing something here?
User avatar
acrid
Posts: 68
Joined: Sun Aug 24, 2003 10:26 pm
Location: Germany

Post by acrid »

you can try:

Code: Select all

mysql zm -u zmuser -p
to see if the db_user is correct.

for locking i get the same error btw:

Code: Select all

mysql> LOCK tables Config READ;
ERROR 1044 (42000): Access denied for user 'zm_admin'@'localhost' to database 'zm'
obviously the db_user for zm has no rights for locking. i think you need the mysql root-user and password.

Code: Select all

$> man woman
$> Segmentation fault (core dumped)
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes. The ordinary ZM user has no privileges usually for modifying tables. Therefore for updates you need to use your systems privileged user, often the db root user.
Phil
bosskong
Posts: 25
Joined: Thu Feb 16, 2006 2:40 am

Post by bosskong »

I'm able to get into mysql with no errors when I run "mysql zm -u zmuser -p" and use zmpass for the password. (Obviously, I'm not really concerned about security here...) But, I'm still not clear on how to run zmupdate.pl. I don't recall ever setting up mysql with a db administrator password or anything similar. I tried the command with my root username and password, but that doesn't work. Any ideas?
User avatar
acrid
Posts: 68
Joined: Sun Aug 24, 2003 10:26 pm
Location: Germany

Post by acrid »

if you never set a root password for mysql, you can use the following to set one:

Code: Select all

mysqladmin -u root password XYZ
mysqladmin -u root -h host.site password XYZ
if it doesn't work, you can start mysql without any authentication, and set the root password afterwards. you have to use the "--skip-grant-tables" option.

Code: Select all

$> man woman
$> Segmentation fault (core dumped)
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

You may also find that your root user has no password in which case you can say '-U root -P' to give a blank password.
Phil
ubell
Posts: 53
Joined: Sun Jul 24, 2005 9:05 pm

Post by ubell »

I have exactly the same problem. zmupdate ignores what I set for user and password:
[root@rascal ZoneMinder-1.22.1]# /usr/local/bin/zmupdate.pl -version=zm-1.21.3 --user=zm --pass=zm
Warning, overriding installed ./zm.conf file with local copy
DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user: 'zmuser@localhost' (Using password: YES) at /usr/lib/perl5/site_perl/5.8.3/ZoneMinder/Config.pm line 89

Note that I specifyied user=zm but it tired to get into the db as 'zmuser'.
I even edited /usr/local/etc/zm.conf to change ZM_DB_USER=zm and it still uses zmuser.

I also edited zmupdate.pl to set db_user='zm' and it has no effect.

I am not a perl hacker so I don't have clue how to debug this, but I really think the error is coming from something it is doing before it reads the parameters.
ubell
Posts: 53
Joined: Sun Jul 24, 2005 9:05 pm

Post by ubell »

Of course as soon as I sent the last email, I thought about what I wrote. It turns out that if you run it from the build directory there is a zm.conf there which gets read by the Config module. I change that to have my proper user and password and things work.
It seems that the flags to zmupdate.pl don't override what is used in the Config.pm module. This seems like a bug.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The zmupdate script only uses the supplied user and password for modifying the DB. It will still use the ordinarily configured one for loading config etc. So if your local zm.conf has incorrect details in it this will fail.
Phil
cabetza1
Posts: 1
Joined: Fri Jan 23, 2009 12:29 am

Same problem Fixed

Post by cabetza1 »

with synaptic chose "mark for complete removal" zoneminder then apply, then install again in the command line or synaptic and for me GOAL!!, maybe is because the "complete removal" erase the database.
Locked