GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Mysql Question (https://gfy.com/showthread.php?t=550345)

Satisfaction 12-09-2005 11:41 PM

Mysql Question
 
I'm trying to re-import a mysql dump, however it keeps giving me errors at this particular table:

CREATE TABLE `phpads_images` (
`filename` varchar(128) NOT NULL default '',
`contents` mediumblob NOT NULL,
`t_stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`filename`)
) ENGINE=INNODB DEFAULT CHARSET=latin1;


The error I'm receiving is:
"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 'defaultCURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY "

Anybody have any ideas?

Cheers

Esbee 12-10-2005 12:04 AM

Quote:

Originally Posted by Satisfaction
I'm trying to re-import a mysql dump, however it keeps giving me errors at this particular table:

CREATE TABLE `phpads_images` (
`filename` varchar(128) NOT NULL default '',
`contents` mediumblob NOT NULL,
`t_stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`filename`)
) ENGINE=INNODB DEFAULT CHARSET=latin1;


The error I'm receiving is:
"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 'defaultCURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY "

Anybody have any ideas?

Cheers

The "timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" stuff is redundant on MySQL4.1+ - see:
http://dev.mysql.com/doc/refman/5.0/...stamp-4-1.html

Change that line to plain 'ole
......, `t_stamp` timestamp,......

... and see if it works as you expect. It should.

The ' DEFAULT CHARSET=latin1' can cause problems as well if the dump was from an older version of MySQL headed into a newer version, or the dump was generated by a 3rd-party program/script that presumes it should be there. Try dumping it as well.

Deek 12-10-2005 12:10 AM

try and just put quotes around the timestamp part.

`t_stamp` timestamp NOT NULL default 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP',

Should fix you up.

IceMaster 12-10-2005 01:08 AM

First remove DEFAULT CHARSET=latin1 and try again.

lawked 12-10-2005 01:41 AM

mysqldump --help ... look at --compatible

I'm pretty sure this is the reason it's happening, solution was posted above.

grumpy 12-10-2005 02:51 AM

you use php myadmin?

this is the right way


CREATE TABLE `phpads_images` (
`filename` varchar(128) NOT NULL default '',
`contents` mediumblob NOT NULL,
`t_stamp` timestamp NOT NULL ,
PRIMARY KEY (`filename`)
) ENGINE=INNODB DEFAULT CHARSET=latin1;


All times are GMT -7. The time now is 09:54 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123