jcanker Posted June 18, 2011 Share Posted June 18, 2011 I've had a MySQL server that's been working fine for years now. Now I can't input lengthy query commands, either by placing it all on one line without using the Enter button until after the semicolon, nor by hitting Enter to break into steps as shown below, nor by importing it as a sql file in phpmyadmin. I've been trying to get this specific query to run: CREATE TABLE IF NOT EXISTS 'events' ( 'event_id' INT NOT NULL AUTO_INCREMENT, 'event_title' VARCHAR(80) DEFAULT NULL, 'event_desc' TEXT, 'event_start' TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', 'event_end' TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY ('event_id'), INDEX ('event_start') ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; INSERT INTO 'events' ('event_title', 'event_desc', 'event_start','event_end') VALUES ( "New Year's Day", 'Happy New Year!', '2010-01-01 00:00:00', 2010-01-01 23:59:59' ), ( 'Last Day of January', 'Last day of the month! Yay!', '2010-01-31 00:00:00', '2010-01-31 23:59:59' ); And it results in this error (this is the phpmyadmin formatted response, but it's the same regardless of which method I use) #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 ''events' ( 'event_id' INT NOT NULL AUTO_INCREMENT, 'event_title' VARCHAR(80) DEF' at line 1 It seems to be truncating at that specific number of characters. Did one of my mysql settings get whacked? Why can't I do anything but very short queries like drop commands or "show tables?" Quote Link to comment https://forums.phpfreaks.com/topic/239710-mysql-truncating-input-commands/ Share on other sites More sharing options...
jcanker Posted June 18, 2011 Author Share Posted June 18, 2011 AS additional info, this is straight from a tutorial, and I've successfully completed the tutorial about 5 months ago on the same mySQL server using a differently named database. Quote Link to comment https://forums.phpfreaks.com/topic/239710-mysql-truncating-input-commands/#findComment-1231370 Share on other sites More sharing options...
DarkKnight2011 Posted June 18, 2011 Share Posted June 18, 2011 Hi, The issue is the quotes you are using for the field names, either dont use any or use the ` one (on my keyboard, very top left, left of number one), I dont know the name of this quote specifically but it should be used for table or field names only, not values. Try this.... CREATE TABLE IF NOT EXISTS `events` ( `event_id` INT NOT NULL AUTO_INCREMENT, `event_title` VARCHAR(80) DEFAULT NULL, `event_desc` TEXT, `event_start` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', `event_end` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`event_id`), INDEX (`event_start`) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; Regards DK Quote Link to comment https://forums.phpfreaks.com/topic/239710-mysql-truncating-input-commands/#findComment-1231411 Share on other sites More sharing options...
jcanker Posted June 18, 2011 Author Share Posted June 18, 2011 That did the trick! You rock! I don't know why it exhibits truncating behavior instead of kicking out an error that's more on target, but oh well. Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/239710-mysql-truncating-input-commands/#findComment-1231513 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.