MySQL: cannot create table with VARBINARY?

I run this query to set up a field VARBINARY(I want it to be real) for my database:

CREATE TABLE `test_books` (`id` int UNSIGNED NOT NULL,`book` VARBINARY, `timestamp` int(11) NOT NULL, UNIQUE KEY `id` (`id`))

It gives me a standard syntax error telling me to check all the remaining code after "VARBINARY".

My version of the MySQL server 5.0.87.d10is that it claims to support a data type with 5.0.

I changed VARBINARYdirectly to int, and the request worked fine, could there be something that I left after it?

+3
source share
2 answers

You need to specify the length for binary fields [var], as well as for char / varchar.

+5

varbinary:

VARBINARY( 100 )
+4

Source: https://habr.com/ru/post/1764146/


All Articles