importing mysql database using mamp, phpMyAdmin - mysql

I am trying to copy a MyIsam dataBase from my a remote server to my local machine for testing. I am using phpMyAdmin on the remote server. I select the database and then export. When I try to import (using mamp, phMyAdmin) I get the following error message
Error
SQL query:
CREATE TABLE IF NOT EXISTS `assignments` (
`uid` int( 11 ) default NULL ,
`rid` int( 11 ) default NULL ,
`semester` varchar( 255 ) default NULL ,
`year` int( 11 ) default NULL
) TYPE = MYISAM ;
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 'TYPE=MyISAM' at line 6
Please Help!
Thanks

Try the trick proposed by Reza (Type=InnoDB) but I use MAMP on local machines and it can support either InnoDB/MyISAM… Which version of MAMP do you use ? (I use the free one)

Maybe your local database doesn't support MyISAM type? Does it have to be MyISAM? You can try changing it to 'TYPE=InnoDB' in the sql dump text file

Related

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version

I have an old database. Am uploading it into SQL using phpmyadmin But when I want to import it I get an error. It seems the first table even cannot get imported:
CREATE TABLE `manager` (
`username` VARCHAR(20) NOT NULL,
`password` VARCHAR(50) NOT NULL,
`email` VARCHAR(100) NOT NULL ,
`deposit` VARCHAR( 50 ) DEFAULT '0' NOT NULL
)
TYPE = MYISAM
CHARACTER SET utf8 COLLATE utf8_new_ci
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 'TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_new_ci' at line 7
How can I resolve this issue?
ENGINE=MyISAM is what you should be using I believe. Also, its probably a good idea to encapsulate your field names like this :
`username` and `password` just to prevent mysql/mariadb picking them up as reserved words.
TYPE is not a valid table_option in Mysql 8, see Manual at https://dev.mysql.com/doc/refman/8.0/en/create-table.html. There is a list of all valid table_options beginning in line 110.
I have an old database
Maybe you can give us more information about your used database by runing the mysql command
SELECT VERSION();

mySQL DEFAULTCURRENT_TIMESTAMP issue with copying table

when copying a table from database to database with phpMyAdmin, I get an error for Timestamp row.
This is my SQL statement:
CREATE TABLE `database`.`table` ( `id` int( 10 )
unsigned NOT NULL AUTO_INCREMENT ,
`Timestamp` timestamp( 6 ) NOT NULL DEFAULTCURRENT_TIMESTAMP( 6 )
ON UPDATE CURRENT_TIMESTAMP( 6 ) ,
`row3` tinyint( 1 ) DEFAULT NULL COMMENT 'Comment',
`row4` tinyint( 1 ) DEFAULT NULL COMMENT 'comment',
PRIMARY KEY ( `id` ) ,
KEY `keyname` ( `row4` ) ) ENGINE = MyISAM
DEFAULT CHARSET = latin1 COLLATE = latin1_german2_ci
And this is the 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 'DEFAULTCURRENT_TIMESTAMP( 6 ) ON UPDATE CURRENT_TIMESTAMP( 6 )
at line 2
I think that there is something wrong with DEFAULTCURRENT_TIMESTAMP and Timestamp (6), but I don't know, what.
The version of phpMyAdmin that you're using is extremely old. Currently, version 4.7 is out; your version 2.11.11.3 is over seven years old. Probably this is some bug that has been fixed, but could also be an incompatibility with your PHP, MySQL, and phpMyAdmin versions (depending on what those other versions are). There are some bug reports from around that time that might be related, but it's difficult for me to trace back and test against such old versions. I suggest that you upgrade to the latest version that you're able to (based on the version requirements) and see if the problem continues.

MySQL error 1064 on website database

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.

Syntax error in MySQL 5.5

I did this simple SQL Query succesfuly from PHP Admin 4 years ago with SQL 5.1. Now I try the same in SQL 5.5 for my new project and getting a syntax error. Mayby somebody can help me to get in the game again.Thanks
SQL query:
CREATE TABLE `mfl` (
`id` INT NOT NULL,
`rank` MEDIUMINT NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM
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 'TYPE = MYISAM' at line 5
Try using
Engine=MyISAM
as Type is deprecated.

MySQL compatibility

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