S
S
Sergey Gulin2016-10-28 11:06:38
PHP
Sergey Gulin, 2016-10-28 11:06:38

Why is the database not loading (error 1064)?

When loading the database, an error occurs:

#1064 - 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 'CREATE TABLE IF NOT EXISTS `modxwww_active_users` (
  `internalKey` int(9) NOT N' at line 24

Full error:
SQL query:

--
-- База данных: `modxwww`
--
-- --------------------------------------------------------
--
-- Структура таблицы `fd_count`
--
CREATE TABLE IF NOT EXISTS `fd_count` (
`id` int( 10 ) NOT NULL AUTO_INCREMENT ,
`filename` text,
`count` int( 10 ) DEFAULT '0',
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

-- --------------------------------------------------------
--
-- Структура таблицы `modxwww_active_users`
--
CREATE TABLE IF NOT EXISTS `modxwww_active_users` (
`internalKey` int( 9 ) NOT NULL DEFAULT '0',
`username` varchar( 50 ) NOT NULL DEFAULT '',
`lasthit` int( 20 ) NOT NULL DEFAULT '0',
`id` int( 10 ) DEFAULT NULL ,
`action` varchar( 10 ) NOT NULL DEFAULT '',
`ip` varchar( 20 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `internalKey` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COMMENT = 'Contains data about active users.';

MySQL said: Documentation
#1064 - 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 'CREATE TABLE IF NOT EXISTS `modxwww_active_users` (
  `internalKey` int(9) NOT N' at line 24

upd:
I tried to load a completely different database, the same problem
Error

SQL query:

INSERT INTO `objects` VALUES (1,'Вологда12',39.8839,59.224,'696465454gfdgsdf',2005,0),(5,'лд',39.8839,59.224,'',2007,1),(13,'тест',42.4107,59.2353,'',2021,0),(24,'Реконструкция автодороги Архангельск –Каргополь – Вытегра – Лодейное Поле – Санкт - Петербург, уч. Казаково – Вытегра II пусковой комплекс Сухарево - Палозеро(Вытегорский район)',36.7858,60.9789,'Реконструкция автодороги Архангельск –Каргополь – Вытегра – Лодейное Поле – Санкт - Петербург, уч. Казаково – Вытегра II пусковой комплекс Сухарево - Палозеро(Вытегорский район)',2018,0),(25,'Строительство а/д Архангельск –Каргополь – Вытегра – Лодейное Поле – Санкт - Петербург, уч. Казаково – Вытегра II пусковой комплекс (Вытегорский район)',36.6539,60.9148,'',2019,0),(27,'Реконструкция автодороги Архангельск –Каргополь – Вытегра -Лодейное Поле – С.Петербург, участок Казаково – Вытегра I пусковой комплекс Казаково – Сухарево (Вытегорский район)',35.9728,60.8291,'Реконструкция автодороги Архангельск –Каргополь – Вытегр[...]

MySQL said: Documentation
#1064 -

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-10-28
@slo_nik

Good afternoon.
The error says that you have a syntax error, an extra quote, a missing quote, etc.
Try to get rid of extra spaces first, remove everywhere

-- в данном случае в int( 9 )
`internalKey` int(9) NOT NULL DEFAULT '0',

R
romy4, 2016-10-28
@romy4

It seems to me that you are doing all this not from the mysql console -u aaa -p -h < file.sql, but shove it into one mysqli_query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question