How i can fix this error, when importing my database? - mysql

CREATE TABLE `oc_appconfig` (
`appid` VARCHAR( 32 ) DEFAULT '' NOT NULL ,
`configkey` VARCHAR( 64 ) DEFAULT '' NOT NULL ,
`configvalue` CLOB DEFAULT NULL ,
PRIMARY KEY ( `appid` , `configkey` )
);
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 'CLOB DEFAULT NULL, PRIMARY KEY(appid, configkey))' at line 1
How i can fix this error. Pls Guys. I need my NextCloud!

MySQL has no CLOB data type. Use TEXT.
See the doc

Related

#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'

error message
#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 '() NOT NULL,
`content` varchar(255) NOT NULL,
`sent_by` varchar(30) NOT NULL' at line 4
sql
CREATE TABLE IF NOT EXISTS `chat` (
`id` INT( 10 ) NOT NULL ,
`member_id` VARCHAR( 30 ) NOT NULL ,
`time_sent` DATETIME( ) NOT NULL ,
`content` VARCHAR( 255 ) NOT NULL ,
`sent_by` VARCHAR( 30 ) NOT NULL ,
`seen` INT( 1 ) NOT NULL
) ENGINE = INNODB AUTO_INCREMENT =22 DEFAULT CHARSET = latin1;
what is the problem now?
I just import into my server and happened this..
In my localhost is no problem when I import the sql
syntax issue
mysql doesnt know how to parse data_type of datetime( ). it only understands datetime or datetime(0-6) as valid data_type s
fix
change
`time_sent` DATETIME( ) NOT NULL ,
to
`time_sent` DATETIME NOT NULL ,
sqlfiddle
create table syntax
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...)
[table_options]
[partition_options]
create_definition:
col_name column_definition
...
column_definition:
data_type [NOT NULL | NULL] [DEFAULT default_value]
...
data_type:
...
| DATETIME[(fsp)]
...
fsp stands for fractional seconds part and must be between 0-6
from data_type syntax definition, mysql understands either
DATETIME(fsp)
or
DATETIME
but not
DATETIME()

MySQL import Database error time datatype error

I exported the database, disabling foreign key checks (as advised by the webhost) and then imported it from the cPanel phpMyadmin.
It threw up the error below
Error
SQL query:
-- --------------------------------------------------------
--
-- Table structure for table `club_listing`
--
CREATE TABLE IF NOT EXISTS `club_listing` (
`id` INT( 11 ) NOT NULL ,
`name` VARCHAR( 50 ) NOT NULL ,
`venue` VARCHAR( 100 ) NOT NULL ,
`time` TIME( 4 ) NOT NULL ,
`description1` VARCHAR( 15 ) NOT NULL ,
`description2` VARCHAR( 15 ) NOT NULL ,
`description3` VARCHAR( 15 ) NOT NULL ,
`memberid` INT( 11 ) NOT NULL COMMENT 'foreignkey for members id for management',
`photoid` INT( 11 ) NOT NULL COMMENT 'link to photo table',
`imagefile` VARCHAR( 200 ) NOT NULL
) ENGINE = INNODB DEFAULT CHARSET = latin1;
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 '(4) NOT NULL,
description1 varchar(15) NOT NULL,
description2 varchar(15' at line 11
I zeroed the error to be the time datatype. However, I checked the mysql documentation and couldn't find anything that explains the error.
the webhost mysql is version 5.5 while xampp is 5.6
If you create it without the length it will compile, I would suggest that if you can get away with it, then just truncate the time to the correct precision in your sql calls. I was having the same error in phpmyadmin perhaps try it in command line.

MySQL syntax error in the CREATE TABLE statement

SQL query:
CREATE TABLE `comment_threads` (
`comment_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',
`updated` TIMESTAMP NOT NULL ,
`timestamp` TIMESTAMP NOT NULL ,
) ENGINE = MYISAM ;
This is an old file that I'm trying to run on HostGator through phpMyAdmin. I get an error that says:
MySQL said: #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 ') ENGINE=MyISAM' at line 5
UPDATE:
If I change the statement to this, I still get an error:
CREATE TABLE comment_threads (
comment_id INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',
updated TIMESTAMP( 14 ) NOT NULL ,
timestamp TIMESTAMP NOT NULL
PRIMARY KEY ( comment_id ) )
ENGINE = MYISAM ;
I get the error:
ERROR 1064 (42000): 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 '( 14 ) NOT NULL ,
timestamp TIMESTAMP NOT NULL
PRIMARY KEY ( comment_id ) )
ENGI' at line 3
Your MySQL query is incorrect. Correcting it to this works.
CREATE TABLE `comment_threads` (
`comment_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`updated` TIMESTAMP NOT NULL ,
`timestamp` TIMESTAMP NOT NULL
) ENGINE=MyISAM;
To run this in phpMyAdmin, you can use the in-built table creator or enter the corrected SQL statement in the SQL query window.
Note that I removed the comma after the last TIMESTAMP NOT NULL line (immediately before the ending ).
UPDATE:
The second statement you posted corrects to this:
CREATE TABLE `comment_threads` (
`comment_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`updated` TIMESTAMP NOT NULL ,
`timestamp` TIMESTAMP NOT NULL,
PRIMARY KEY(`comment_id`)
) ENGINE=MyISAM;
Here are the problems you introduced in your second CREATE TABLE statement:
TIMESTAMP( 14 ) should just be TIMESTAMP (per the documentation)
You need a comma after the line TIMESTAMP NOT NULL line. The comma is necessary now because unlike in the first example, you're separated two parts of the statement: the TIMESTAMP NOT NULL line and the PRIMARY KEY declaration.
If you want more information on simple methods for debugging SQL statements, I strongly suggest you look at my answer to this question (see the section titled A bit more information on how to methodically fix errors like this).
Make sure that when you change a CREATE TABLE statement, or any piece of code, that you make changes in small enough increments that you're only "breaking at most one thing at a time." In the case of your second CREATE TABLE statement, there was no reason to change the first TIMESTAMP declaration, and doing so broke the code. That line was working; no need to change it.

MySql Syntax Error From AutoGenerated Creation

CREATE TABLE `db`.`Complete` (
`CompleteId` MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`HoursTaken` DOUBLE( 5 ) NOT NULL ,
`DateFinished` DATETIME NOT NULL
) ENGINE = MYISAM
I am trying to create this simple table, however, I get an error. The above code is the code generated by a UI for a MySql database.
I get this error:
#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 ') NOT NULL ,
`DateFinished` DATETIME NOT NULL
) ENGINE = MYISAM' at line 4
I am not sure what to change.
You need to add the precision to the DOUBLE datatype, it should be DOUBLE(5,n) I think.
I solved this by using float instead of double, this was the generated code:
CREATE TABLE `db`.`Complete` (
`CompleteId` MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`HoursTaken` FLOAT NOT NULL ,
`DateFinished` DATETIME NOT NULL
) ENGINE = MYISAM

What's wrong with these columns?

is there something that I'm missing? Thanks :)
Error
SQL query:
ALTER TABLE `venues`
ADD `IF_AIRCONDITIONING` BOOLEAN( 1 ) NOT NULL DEFAULT '0'
, ADD `IF_LIVE_MUSIC` BOOLEAN( 1 ) NOT NULL DEFAULT '0'
, ADD `IF_TABLE_FOOTBALL` BOOLEAN( 1 ) NOT NULL DEFAULT '0'
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
'(1) NOT NULL DEFAULT '0', ADD `IF_LIVE_MUSIC` BOOLEAN(1) NOT NULL DEFAULT '0', ' at line 1
Try getting rid of the quotes around 0 in DEFAULT '0', or use FALSE or false (also without quotes)
Also you shouldn't have to specify a length for boolean fields, try getting rid of ( 1 )