Page 1 of 1

Use of MySQL during Build and Install steps, help

Posted: Fri Jan 16, 2009 12:03 am
by we4zonM
The Wiki Build from source section, has
For a new installation the next thing you will need to do is create your database and database users. So type the commands as follows,

mysql mysql < db/zm_create.sql
mysql mysql
grant select,insert,update,delete on <database>.* to '<database>'@localhost identified by '<database>';
quit
mysqladmin reload

You may need to supply a username and password to the mysql commands in the first place to give yourself sufficient privileges to perform the required commands.
I seemed to get this to work before, but now I repeatedly get ERROR 1064, error in SQL syntax. What is the correct syntax to use if you have configured it with ZM_DB_NAME=zm1 ZM_DB_USER=zmuser1 ZM_DB_PASS=zmpass1 ?

I tried this:
mysql -u root -p mysql < db/zm_create.sql
which ran okay.
mysql -u root -p mysql
which gave me a mysql prompt "mysql>"
grant select,insert,update,delete on zm1.* 'zmuser1'@localhost identified by 'zmpass1'
and then got the ERROR 1064, SQL syntax error. I also tried it without the ' as in:
mysql> grant select,insert,update,delete on zm1.* zmuser1@localhost identified by zmpass1
and the same ERROR 1064. What is the correct syntax?

Posted: Sat Jan 17, 2009 6:21 am
by nuck
From a mysql command prompt you can

mysql> source /path-to/zm_create.sql;

then, to set up the zm user

mysql> use mysql;
mysql> grant select, insert, update, delete on zm.* to 'yourzmuser' identified by 'yourzmadmin';
mysql> grant select on zm.* to 'yourzmuser' identified by 'yourzmuser';
mysql> update user set host = 'localhost' where user like 'zm%';
mysql> \quit
mysqladmin reload

Posted: Mon Jan 19, 2009 1:05 am
by cordel
All commands in the mysql console must be terminated with a semicolon at the end or else it assumes you want it to continue your input.

Setting up the database you can follow the documentation line for line as this is standard across all distros just be sure to replace the user and password with anything you might have defined from configure.

Posted: Mon Mar 02, 2009 3:37 pm
by escu
Hello

I am trying to install version 1.24.1 and when trying to import in MySQL the file zm_create.sql.in i get this error:

Code: Select all

root@video:/usr/local/src/ZoneMinder-1.24.1# mysql -u root -p < db/zm_create.sql.in
Enter password:**********
ERROR 1064 (42000) at line 29: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@ZM_MYSQL_ENGINE@' at line 16
I use Slackware 12.2 with MySQL 5.0.67. Line 16 is a commented line (--) :shock:

Line 29 contains the CREATE TABLE 'Config' ( statement

Posted: Mon Mar 02, 2009 9:22 pm
by cordel
zm_create.sql.in is the wrong file, you should be using zm_create.sql that is created after you run make.

Posted: Tue Mar 03, 2009 8:19 am
by escu
Yeah, I have realised that. I'm an idiot, going to bang my head to the wall :lol:

Posted: Mon Feb 15, 2010 6:44 pm
by attilahooper
Hello all.

I'm at the point of populating the ZM with tables using zm_create.sql
mysql -u root -p < db/zm_create.sql

I get the error

ERROR 1064 (42000) at line 29: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 16


EDIT: I must add that I ~had~ the Ubuntu 9.10 package ZM 1.24.1 installed already. I removed the package because I didnt figure out how to get the email scripting working (perl scripts missing). The database was wiped-out.

ALSO: Mysql version: 5.1.37-1ubuntu5.1 (Ubuntu)


doesnt appear to anything wrong with the script

Code: Select all

-- MySQL dump 10.9
--
-- Host: localhost    Database: zm
-- ------------------------------------------------------
-- Server version	4.1.16-log

/*!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`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `zm`;

USE `zm`;

--
-- Table structure for table `Config`
--

DROP TABLE IF EXISTS `Config`;
CREATE TABLE `Config` (
  `Id` smallint(5) unsigned NOT NULL default '0',
  `Name` varchar(32) NOT NULL default '',
EDIT: not solved but i installed the Ubuntu9.04 ZM1.24.2 package on Koala 9.10 with no problems so far with a Logitech C200 {Yuyv and Pal, 320x240} 7+fps

thanks you guys;
ftp://ftp.northern-ridge.com.au/zonemin ... ntu/jaunty

Posted: Wed Feb 17, 2010 8:06 am
by DiBog
I have the same problem
MySQL version 5.1.37
Ubuntu Linux 9.10
ZM_VERSION=1.24.2

Code: Select all

/usr/src/zm# mysql -p zm < db/zm_create.sql
Enter password:
ERROR 1064 (42000) at line 29: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 16
Are there any ideas?

Posted: Wed Feb 17, 2010 1:21 pm
by attilahooper
DiBog wrote:I have the same problem
MySQL version 5.1.37
Ubuntu Linux 9.10
ZM_VERSION=1.24.2
try the Ubuntu9.04 package from these guys, works great for me so far.
ftp://ftp.northern-ridge.com.au/zonemin ... ntu/jaunty