This has been asked before, but I cannot seem to find a solution that'll work.
I created a database on my localhost server using Mysql, Version information: 4.2.7.1
I have export the .sql file many times and imported it into other localhost servers without any problems.
Now I'm ready to go live, and I am trying to import the .sql file into my hosted server phpMyAdmin. Version information: 4.3.8, latest stable version: 4.6.4
When I do I get error 1293:
SQL Error (1293): Incorrect table definition; there can be only one
TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
I have many tables that have the same 2 columns:
date_created which is set to type timestamp, default current_timestamp
last_update which is set to type timestamp, default NULL, on update CURRENT_TIMESTAMP
This way I can track when a row is added and updated.
How can I change these rows to make the import file work ok?
Related
I updated from Windows 10 to Windows 11. Now I can not alter any table anymore on MySQL Workbench.
I increased the timeout to 600 seconds, but still same error. My DB is quiet empty, so it should be no problem of size.
Do I have to change something in the configuration after updating to Win11 for MySQL Workbench?
I have a Python script, which is using this MySQL-DB to use some entries from this DB, that is still working.
I can not share error code as text, because of no copy-paste-functionality.
EDIT: I add the text a can be seen in the screenshot:
Error: There was an error while applying the SQL script to the database.
Executing:
ALTER TABLE 'map'.
ADD COLUMN `route_location` VARCHAR(45) NULL DEFAULT NULL AFTER `route_event`;
Operation failed: There was an error applying thee SQL script to the database.
ERROR 2013: Lost connection to MySQL server during query
SQL Statement:
ALTER TABLE `map`.`routepoints`
ADD COLUMN `route_location` VARCHAR(45) NULL DEFAULT NULL AFTER `route_event`
I tried it with SQL-Script and also with GUI.
After restarting MySQL-Workbench and several times of trying to rerun the SQL-Script it creates the column in the table. Since then I have no problem and its working properly, even if I add a new column.
I designed a database model on MySQLWorkbench. Then, I export the model to generate a SQL script. Finally, when I import it in MariaDB PhpMyAdmin it raises errors like :
#1067 - Invalid default value for 'created'
MariaDB version : 10.5.4
Do you have any idea?
Here is my solution:
create DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
MySQL refused the date to be like this: 0000-00-00 00:00:00
I know this is old, but just ran into this, appears Maria 10.5 won't accept invalid inserts even when ALLOW_INVALID_DATES is set in SQL mode, 10.3 would. I cannot find any reference of this in the documentation, but I can insert invalid dates in 10.3 and cannot in 10.5 on several server I've tested on. Dealing with this in an upgrade from 10.3 on a large database and regardless of whether allowing nulls is a good practice, it's broken a massive application as a result and we're bailing back to 10.3.
am trying to import Magento 2 database on 5.5.52-MariaDB. while it was import I got an error the import stop at admin_user ERROR: "MySQL Error There can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause"
I am wondering if 5.5.52-MariaDB isn't the right version and that's why I am getting this error.
As per Magento 2 Docs it does not say which version of MariaDB it requires. Does anybody knows or have more imformation about this? Thank's in advance.
Multiple TIMESTAMP columns with CURRENT_TIMESTAMP in the DEFAULT clause are allowed in MariaDB starting from 10.0. Neither MariaDB 5.5 nor MySQL 5.5 support them.
I am trying to duplicate one of my databases on a remote bluehost server in order to setup a dev and stage environment for my drupal website. Dev is already setup/populated and working fine, so I am now simply trying to duplicate the dev database. Using phpmyadmin on windows (PHP 5.2.17, MySQL 5.5.42). I have done the following steps:
created site_stage database
exported/dumped all tables from site_dev db into compressed sql.gz file
imported all tables into site_stage db
Import fails with $1064 error:
INSERT INTO `cache_bootstrap` (`cid`, `data`, `expire`, `created`, `serialized`, `tags`, `checksum`) VALUES
('system_list', 0x613a323a7b733a353a227468656d65223b613a31333a7b733a363a2262617274696b223b433a33313a2244727570616c5c436f72655c457874656e73696f6e5c457874656e73696f6e223a323339343a7b613a31363a7b733a343a2274797065223b733a353a227468656d65223b733a383a22706174686e616d65223b733a33343a22636f72652f7468656d65732f62617274696b2f62617274696b2e696e666f2e796d6c223b733a383a2266696c656e616d65223b733a31323a2262617274696b2e7468656d65223b733a373a2273756270617468223b733a31333a227468656d65732f62617274696b223b733a363a226f726967696e223b733a343a22636f7265223b733a363a22737461747573223b693a313b733a343a22696e666f223b613a31393a7b733a343a226e616d65223b733a363a2242617274696b223b733a343a2274797065223b733a353a227468656d65223b733a31303a2262617365207468656d65223b733a363a22636c61737379223b733a31313a226465736372697074696f6e223b733a38363a224120666c657869626c652c207265636f6c6f7261626c65207468656d652077697468206d616e79[...]
#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 '?' at line 2
Thought maybe it didn't like the length of that value, so I just deleted that cache_bootstrap query from uncompressed version of dump file (shouldn't need this cache table anyways) and tried to import again, this time, it failed with the following error:
CREATE TABLE IF NOT EXISTS `key_value` (
`collection` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'A named collection of key and value pairs.'
`value` longblob NOT NULL COMMENT 'The value.',
PRIMARY KEY (`collection`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Generic key-value storage table. See the state system for…';
#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 '`value` longblob NOT NULL COMMENT 'The value.',
PRIMARY KEY (`collection`,`nam' at line 9
I've read a lot of '1064 error on import' threads, but none of them help and most of them pertain to moving sql data between servers. Very strange that I would get syntax errors copying tables from one database to another on same server, with same mysql version, etc. Any ideas? Thanks in adv.
I am using mysql 5.6 on my local machine for my laravel app and Heroku is on 5.5 meaning Ì am getting an error in production :
General error: 1293 Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause.
I suppose I can't upgrade the mysql version on Heroku so is there a way around this ?