SQL DB_ERROR_SYNTAX

Hello,

I am just installing manually Dolibarr on Mac OS X (10.10).
When going through the installation steps, I got the following error :

Erreur SQL DB_ERROR_SYNTAX 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 'virtual tinyint DEFAULT 0 NOT NULL, fk_parent integer DEFAULT 0, ’ at line 11

Could anyone help ? Thanks in advance.


additional information:

Connexion au serveur : localhost Ok
Version de la base 5.7.10
Nom de la base de données dolibarr
Création de la table llx_product et de sa clé primaire
Request 163 : create table llx_product ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(128) NOT NULL, entity integer DEFAULT 1 NOT NULL, ref_ext varchar(128), datec datetime, tms timestamp, virtual tinyint DEFAULT 0 NOT NULL, fk_parent integer DEFAULT 0, label varchar(255) NOT NULL, description text, note text, customcode varchar(32), fk_country integer DEFAULT NULL, price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, price_min_ttc double(24,8) DEFAULT 0, price_base_type varchar(3) DEFAULT ‘HT’, tva_tx double(6,3), recuperableonly integer NOT NULL DEFAULT ‘0’, localtax1_tx double(6,3) DEFAULT 0, localtax2_tx double(6,3) DEFAULT 0, fk_user_author integer DEFAULT NULL, fk_user_modif integer, tosell tinyint DEFAULT 1, tobuy tinyint DEFAULT 1, tobatch tinyint DEFAULT 0 NOT NULL, fk_product_type integer DEFAULT 0, duration varchar(6), seuil_stock_alerte integer DEFAULT 0, url varchar(255), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT NULL, accountancy_code_sell varchar(32), accountancy_code_buy varchar(32), partnumber varchar(32), weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, length_units tinyint DEFAULT NULL, surface float DEFAULT NULL, surface_units tinyint DEFAULT NULL, volume float DEFAULT NULL, volume_units tinyint DEFAULT NULL, stock integer, pmp double(24,8) DEFAULT 0 NOT NULL, fifo double(24,8), lifo double(24,8), canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, hidden tinyint DEFAULT 0, import_key varchar(14), fk_price_expression integer, desiredstock integer DEFAULT 0, fk_unit integer DEFAULT NULL )ENGINE=innodb;
Executed query : create table llx_product ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(128) NOT NULL, entity integer DEFAULT 1 NOT NULL, ref_ext varchar(128), datec datetime, tms timestamp, virtual tinyint DEFAULT 0 NOT NULL, fk_parent integer DEFAULT 0, label varchar(255) NOT NULL, description text, note text, customcode varchar(32), fk_country integer DEFAULT NULL, price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, price_min_ttc double(24,8) DEFAULT 0, price_base_type varchar(3) DEFAULT ‘HT’, tva_tx double(6,3), recuperableonly integer NOT NULL DEFAULT ‘0’, localtax1_tx double(6,3) DEFAULT 0, localtax2_tx double(6,3) DEFAULT 0, fk_user_author integer DEFAULT NULL, fk_user_modif integer, tosell tinyint DEFAULT 1, tobuy tinyint DEFAULT 1, tobatch tinyint DEFAULT 0 NOT NULL, fk_product_type integer DEFAULT 0, duration varchar(6), seuil_stock_alerte integer DEFAULT 0, url varchar(255), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT NULL, accountancy_code_sell varchar(32), accountancy_code_buy varchar(32), partnumber varchar(32), weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, length_units tinyint DEFAULT NULL, surface float DEFAULT NULL, surface_units tinyint DEFAULT NULL, volume float DEFAULT NULL, volume_units tinyint DEFAULT NULL, stock integer, pmp double(24,8) DEFAULT 0 NOT NULL, fifo double(24,8), lifo double(24,8), canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, hidden tinyint DEFAULT 0, import_key varchar(14), fk_price_expression integer, desiredstock integer DEFAULT 0, fk_unit integer DEFAULT NULL )ENGINE=innodb;

Which version of dolibarr do you use ?

This may be a compatibility problem with mysql 5.7 and dolibarr 3.8 or less
“virtual become a reserved keyword”
https://dev.mysql.com/doc/refman/5.7/en/keywords.html#ftn.idm140188832199040
Are you able to test on mysql 5.6 ?

If not, you must wait dolibarr 3.9

Same Issue - Dolibarr 3.5.8 installed w/ MySQL 5.7. On Lubuntu 16.10.
This is the version installed with a new install of Dolideb.
Any way around this? Is there an updated version of Dolibarr that is compatible?

Thanks!
MG

I downloaded the latest edition of dolibarr 4.0.3 but when I try to install it it 'defaults" somehow to 3.5.8!! and I get the mysql syntax error referred to above. I am tying to install it on xubuntu 16.04.
I am new to linux - trying to escape microsoft and getting very frustrated w/ lack of documentation and help.
Anyone out there?
Thanks
MG

For avoiding the SQL error you need to add back ticks ([b][/b] not [b]'[/b]) around the reserved virtual` keyword in file htdocs/install/mysql/tables/IIx_product.sql on line 33

If it’s a new dolibarr installation (no problem to lose your data). You can drop your database and create a new one to have a clean installation of 4.0.3.
4.0.3 has no ‘virtual’ keyword issue.

Thanks for your help!
I have since tried installing ubuntu 16.04 LTS to see if this got around it.
If I try to manually install (dpkg) 4.0.3-4_all.deb, I get dependency issues. If I then use apt-get install, it removes dolibarr and when I try again to install get dependency issues!
If I try to install automatically then 3.5.8 is installed and I get the syntax error!
I will attempt to use your first solution using the “back ticks” and let you know.

Is LINUX really THIS HARD to use?
Thanks!

Once you installed 3.5 using apt-get, you can download the zip version of 4.0.3 and unzip into your dolibarr web root. Then you go to htdocs/install and choose the new installation start option.

Ubuntu desktop is piece of cake, but when when you want to use Ubuntu server you need to have system maintenance knowledge. When you come from windows you are used to everything with some mouse clicks, but on linux you need to know to use the CLI commands.

I have a very similar problem.
I downloaded the January 24th 4.0.4 version of Dolibarr, on Ubuntu 16.04 LTS.
Yet, version details states it’s actually : 3.5.8.

I have another machine running Debian. Package 4.0.3 works great.
Any idea on how to proceed ?

Hi Michael Agiles, you can find a quick workaround to your troubles in my topic : www.dolibarr.org/#this-topic-no-longer-exists