Password MYSQL and starting ZM

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Password MYSQL and starting ZM

Post by teraquad »

Hi,
I can start the ZM package but it hangs with "

Code: Select all


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

I accidentally answered yes when the PW question came up during the install.
How can i fix the database so zm will run.

I know nothing of SQL so be basic.
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Password MYSQL and starting ZM

Post by PacoLM »

http://www.cyberciti.biz/faq/mysql-chan ... -password/

I suppose that changing it to the root password may work.

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

I am assuming that you are referring to the sql root password setting during it's install?

Have you checked the readme file with the package, normally has instructions for DB setup etc, including creating the zmuser account. Example of one below
https://github.com/ZoneMinder/ZoneMinde ... DME.Fedora
Actual user creation step. But please read the readme to get it all correct.
mysql -u root -p mysql> grant select,insert,update,delete,lock tables,alter,create on zm.* to 'zmuser'@localhost identified by 'zmpass';

zm will be using details from zm.conf, in /etc/zoneminder or /etc/zm, not so sure on Fedora. Normally zmuser and zmpass as per the SQL above, but possible to change if you change in sql and zm.conf.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,

Well, i deleted the ZM database so i could re-install it. The bad news is i cannot create a fresh one, don't know how.
I tried ( mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql) and had no luck. So i am studying the links given for another way.

ps: I am Using Fedora 23 and 128.1 for ZM. Installed via RPM

Thanks, George!
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

If you are using an rpm from standard repo it doesn't include ffmpeg, which hampers ability to do some key functions.

http://zmrepo.zoneminder.com has better builds with ffmpeg, but no 23 yet, so if you are not comfortable building your own from the fedora 22 version maybe hold off, roll back or swap distro.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,

Thanks! I have used exactly that rpm for my install and pulled ffmpeg from that site. so i am happy with that..

It's the idiot that deleted that db. (me): I have what is a builder file but don't know how to use it. to create the database.

Code: Select all

zm_create.sql         zm_update-1.19.2.sql  zm_update-1.23.2.sql
zm_update-0.0.1.sql   zm_update-1.19.3.sql  zm_update-1.23.3.sql
zm_update-0.9.10.sql  zm_update-1.19.4.sql  zm_update-1.24.0.sql
zm_update-0.9.11.sql  zm_update-1.19.5.sql  zm_update-1.24.1.sql
zm_update-0.9.12.sql  zm_update-1.20.0.sql  zm_update-1.24.2.sql
zm_update-0.9.13.sql  zm_update-1.20.1.sql  zm_update-1.24.3.sql
zm_update-0.9.15.sql  zm_update-1.21.0.sql  zm_update-1.24.4.sql
zm_update-0.9.16.sql {code]
How do i use that kind of file?

Thanks! george
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

OK so the command about mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql should be the one. It should ask for mysql root password, you said it didn't work so give details of what happened.
Readme for that rpm.
https://github.com/ZoneMinder/ZoneMinde ... DME.Fedora

Also you might get more hits/help in 1.28 forum, I will see if we can get a mod to move this topic. This area is more for posting a hint or tip as opposed to getting one.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,

The command does cause a pause, ask for the password and then the command prompt just as expected. however i find no hint of it having done anything. The database is not affected one way or another that i can tell. It is just not populating.

Do you suppose i should rename the current zm database and start all over again

Thanks
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

So now you have got me confused. You have a zm db, but say zm_create is not doing anything? It creates the db structure so if you have db with tables then it's job is done. Does that sound like where you are?
After that you need to create a user to access the database, check here to see if you already have zmuser

Code: Select all

select User,Host from mysql.user;
To create the user if they don't exist

Code: Select all

grant select,insert,update,delete,lock tables,alter,create on zm.* to 'zmuser'@localhost identified by 'zmpass';
So that creates a user called zmuser and password zmpass, if you don't know the password delete the account and recreate it. Just google mysql delete user for that if you need it.
If you want a different account for DB then change zmuser and zmpass in creation above, then follow below from the fedora readme.
If you have chosen to change the zoneminder database account credentials to something other than zmuser/zmpass, you must now edit /etc/zm/zm.conf. Change ZM_DB_USER and ZM_DB_PASS to the values you created in the previous step.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,

I am happy to say half the problems have been solved. I have been trying to load a blank database. Still cant fathom how that happened. Just happened to notice the file size 1k.

Anyway i will be applying your advice with a new file and will see if that helps.

I do have the db password modified. But i don't feel as though I'm that far into the solution yet.

Thanks for your patience
I will post an update as soon possible.
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,

After running through the iterations of the command. I found the following reported errors.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@ZM_MYSQL_ENGINE@' at line 16

Notice in ./../php/SqlParser/Lexer.php#809
Uninitialized string offset: 459

-- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686)
--
-- Host: localhost Database: @ZM_DB_NAME@
-- ------------------------------------------------------
-- Server version 5.6.13

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `@ZM_DB_NAME@`;
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `@ZM_DB_NAME@`;

USE `@ZM_DB_NAME@`;
Hope this helps, I haven't a clew as to what may be wrong!

thanks!
george
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

Only theory I have on that is you are not looking at a packaged distribution.
Part of the make process for zoneminder takes this line
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `@ZM_DB_NAME@`;
And inserts the correct name for the db, and a bunch of other stuff. End result is would look like this.
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `zm`;

All I can think is your taking fedora 22 rpm from zmrepo and putting on 23 isn't working out as it should. Since then zmrepo has 23 released now, so if you are not attached to this build I would ditch it and bring up a new one from scratch and then install from zmrepo version.

http://zmrepo.zoneminder.com/f/23/x86_64/
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

Hi,
Thanks, that is the best explanation I've heard yet. All else looks good. I basicly took a clean fc23 install and loaded Apache, MariaDB and zoneminder. from the zm repository. that could have been maybe 1 week ago so a mix of files is possible.

Would you recommend compiling or RPMing the install. I have a limited knowledge if compiling anything but am game for most anything.

Thanks again for your help. It would have been hopeless otherwise....

george....
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Password MYSQL and starting ZM

Post by SteveGilvarry »

RPM should take care of everything, I am not a fedora user but plenty around. If you are get stuck with the zmrepo stuff ask in the forum section linked below, more people in there and proper place for questions and discussion on 1.28 installation.

viewforum.php?f=32
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
teraquad
Posts: 90
Joined: Fri Mar 09, 2012 2:03 pm
Location: New Bern, NC

Re: Password MYSQL and starting ZM

Post by teraquad »

I know you can't believe it but it works! Just need to add a couple of cameras and it's off to the races.

What i did was delete and re install 1.28, change the password to match mine and bingo
Fedora 23, ZM 1.28
N4ZPO (ham Radio)
8)
Post Reply