I have a script that I got online that I wanted to try out. Everything has worked so far except for the last step which is to import a .sql file using phpmyadmin. The .sql script is
CREATE TABLE lil_urls (
id varchar(255) NOT NULL default '',
url text,
date timestamp(14) NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
My server version is 5.5.34-cll - MySQL Community Server (GPL)
The error I get says
#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 '(14) NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM' at line 4
How do I properly import this file?
Thanks
Related
I generate SQL file from phpmyadmin in one server, but get error 1064 when importing to another phpmyadmin server with error near line "json DEFAULT NULL"
Hi, i was Exporting an SQL file from phpmyadmin, and then imported it to another server with phpmyadmin but get the following error
I would be thankfull if you could point me where i did wrong.
Thankyou very much.
Error
SQL query:
--
-- Database: gitaemr
--
-- Table structure for table com_gita_paycheck_staff
CREATE TABLE `com_gita_paycheck_staff` (
`id` int(11) NOT NULL,
`hour` float DEFAULT NULL,
`shift` float DEFAULT NULL,
`services` json DEFAULT NULL,
`sversion` varchar(45) DEFAULT 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 MariaDB server version for the right syntax to use
near 'json DEFAULT NULL, sversion varchar(45) DEFAULT NULL )
ENGINE=InnoDB DEFAULT' at line 15
you can change json to array, yes it's because of MariaDB Version on Debian stable has no json
I've spent a few hours looking at the manual and need help now correcting the below erros. Thank you.
LOG:
Executing SQL script in server
ERROR: 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 ''ACTION')
ENGINE = InnoDB' at line 17
SQL Code:
-- -----------------------------------------------------
-- Table `mydb`.`Patients`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Patients` (
`PatientKey` INT(11) NOT NULL,
`FirstName` VARCHAR(45) NULL,
`MiddleName` VARCHAR(45) NULL,
`LastName` VARCHAR(45) NULL,
`PhoneNumber` VARCHAR(20) NULL,
`doctors_DoctorKey` INT(11) NOT NULL,
PRIMARY KEY (`PatientKey`),
INDEX `fk_Patients_doctors1_idx` (`doctors_DoctorKey` ASC) VISIBLE,
CONSTRAINT `fk_Patients_doctors1`
FOREIGN KEY (`doctors_DoctorKey`)
REFERENCES `mydb`.`doctors` (`DoctorKey`)
ON DELETE NO ACTION
ON UPDATE NO 'ACTION')
ENGINE = InnoDB
SQL script execution finished: statements: 6 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
What I'm working with:
Server type: MySQL
Server version: 8.0 - MySQL Community Server(GPL)
MySQL Workbench 8.0 CE
Remove the word VISIBLE......
Remove the word VISIBLE; it is not valid in the version you are running.
I am a little embarrassed asking this question but I seem to be stumped.
I am using MySQL 5.7 and am trying to upload to my online server which has MySQL 5.6. phpMyAdmin was used create the database. I get the same error when I try to restore the database in my local phpMyAdmin (part of my WAMP server).
I have also studied the My SQL reference documentation as well as several internet searches. Here is the error:
SQL query:
DROP TABLE IF EXISTS `heyx1_assets`;
CREATE TABLE `heyx1_assets` (
`id` int(10) UNSIGNED NOT NULL COMMENT 'Primary Key',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT
) ;
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 ')' at line 4
Any help will be appreciated. My client is becoming very impatient.
You have a COMMENT, but no comment. You need a string after COMMENT:
CREATE TABLE `heyx1_assets` (
`id` int(10) UNSIGNED NOT NULL COMMENT 'Primary Key',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Comment goes here'
---------------------------------------------------^
) ;
Which phpMyAdmin versions are you using on each server? This seems like it may have been a bug with an older version of phpMyAdmin (which had trouble exporting in a similar way to what you're describing); I suggest you upgrade to the latest (which is currently 4.6.5.2).
You can also edit the SQL file to manually fix the COMMENT as shown by Gordon Linoff.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near ') VIRTUAL,
`title_type` VARCHAR(45) NULL DEFAULT null,
PRIMARY KEY (`id`))' at line 2
Here is a part of script:
CREATE TABLE IF NOT EXISTS `sggis`.`maps_type` (
`id` INT GENERATED ALWAYS AS () VIRTUAL,
`title_type` VARCHAR(45) NULL DEFAULT 'yandex',
PRIMARY KEY (`id`))
ENGINE = InnoDB;
SQL says that problem is in the 2nd line, but i can't find it.
Code generated by MySQL Workbench.
When using VIRTUAL columns you need to specify the expression
Any legal, deterministic expression which can be calculated is
permitted, with the following exceptions:
Your expression is blank.
I am trying to add a table to my schema in MySQL workbench and I keep getting an error.
Message Log:
Executing:
CREATE TABLE `TestVisual`.`arc` (
`arcid` INT NOT NULL DEFAULT 0 COMMENT '',
`name` VARCHAR(45) NULL DEFAULT '' COMMENT '',
PRIMARY KEY (`arcid`) COMMENT '');
Operation failed: There was an error while applying the SQL script to the database.
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 'COMMENT '')' at line 4
SQL Statement:
CREATE TABLE `TestVisual`.`arc` (
`arcid` INT NOT NULL DEFAULT 0 COMMENT '',
`name` VARCHAR(45) NULL DEFAULT '' COMMENT '',
PRIMARY KEY (`arcid`) COMMENT '')
I have tried to follow a tutorial but I still get the error. There are other tables already on this server and I am able to change their data along with add and delete columns. I am also on the root user.
Barmar answered it above in the comments. This server is using an older version of MySQL so there are not allowed to be COMMENT in the sql. Deleted them and it worked fine.