Import 5.5 sql export to 5.0 sql? - mysql

I have made a website locally on my mac, using MAMP. Now i need to upload the site to the internet. So i upload the files via FTP, create a database using the Cpanel, and now i want to import the database. But i keep getting "#1064 - You have an error in your SQL syntax;" I just found out that the sql version on MAMP is: 5.5.33 and the version my web provider uses is 5.0.95 could this be the problem?
how do i solve this?
This is the code that it complains about:
CREATE TABLE `wp_commentmeta` (
\ `meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , \ `comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' , \ `meta_key` VARCHAR( 255 ) DEFAULT NULL , \ `meta_value` LONGTEXT , \ PRIMARY KEY ( `meta_id` ) , \ KEY `comment_id` ( `comment_id` ) , \ KEY `meta_key` ( `meta_key` ) \
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

Related

How To Upgrade from MySQL 5.1.72 to 5.5.45 in 1and1 vps

I have bought VPS from 1and1.com and changed name server of my domain (previously it was on godaddy ) . But i noticed in godaddy i was using MySQL 5.5.45 and here on 1and1 mysql version is 5.1.72
Due to this when i have run my database script on 1and1 with 5.1.72 MySQL version it is giving error
Unknown collation: 'utf8mb4_unicode_ci'
My Database is wordpress database - i am having error at below code as this code contains 'utf8mb4_unicode_ci'
CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`meta_id`),
KEY `comment_id` (`comment_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=174 ;
I had this issue before.
I have changed "utf8mb4" to "utf8" in the script file.
And "utf8mb4_unicode_ci" to "utf8_general_ci".
So, script was executed successfully.
Hope, help this to you.

MySQL database import error #1064

I have a SQL database that I want to import using phplyadmin but I am getting this error.
CREATE TABLE `wp_commentmeta` (
`meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0',
`meta_key` VARCHAR( 255 ) DEFAULT NULL ,
`meta_value` LONGTEXT,
PRIMARY KEY ( `meta_id` ) ,
KEY `comment_id` ( `comment_id` ) ,
KEY `meta_key` ( `meta_key` ( 191 ) )
) ENGINE = Aria AUTO_INCREMENT =3843 DEFAULT CHARSET = utf8
PAGE_CHECKSUM =1 DELAY_KEY_WRITE =1 TRANSACTIONAL =1;
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 'PAGE_CHECKSUM=1 DELAY_KEY_WRITE=1 TRANSACTIONAL=1' at line 9
If you are not using MariaDB, change ENGINE=Aria to ENGINE=MyISAM(or ENGINE=InnoDB) and remove PAGE_CHECKSUM=1 and TRANSACTIONAL =1;
Find an example here

SQL syntax errors when importing database into phpMyAdmin (MAMP)

In order to import a 120Mb database into phpMyAdmin with MAMP I split it up using the following:
split -l 100 /Applications/MAMP/htdocs/test/database_test_wordpress.sql /Applications/MAMP/htdocs/test/dbpart-
However when importing the second part I get the error:
Error
SQL query:
CREATE TABLE `wp_comments` (
`comment_ID` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`comment_post_ID` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0',
`comment_author` TINYTEXT NOT NULL ,
`comment_author_email` VARCHAR( 100 ) NOT NULL DEFAULT '',
`comment_author_url` VARCHAR( 200 ) NOT NULL DEFAULT '',
`comment_author_IP` VARCHAR( 100 ) NOT NULL DEFAULT '',
`comment_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_date_gmt` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_content` TEXT NOT NULL ,
`comment_karma` INT( 11 ) NOT NULL DEFAULT '0',
`comment_approved` VARCHAR( 20 ) NOT NULL DEFAULT '1',
`comment_agent` VARCHAR( 255 ) NOT NULL DEFAULT '',
`comment_type` VARCHAR( 20 ) NOT NULL DEFAULT '',
`comment_parent` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0',
`user_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY ( `comment_ID` ) ,
KEY `comment_post_ID` ( `comment_post_ID` ) ,
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 '' at line 18
Do I need to upgrade the database somehow? Or am I way off?! Sorry, new to this :-)
Note: I first tried increasing upload_max_filesize, memory_limit and post_max_size in MAMP's php.ini but on import I got a MySQL server has gone away error.
split is a linux command that will just slice text. You can't just do that and expect an import to work. In your particular example, the creation of a table is not being properly finished by a ;, which means you are most likely missing the creation of indexes or constraints below the cut part of the text.
I wouldn't slice the file at all and import the whole SQL file from the console instead of using php for that. This should do the trick:
mysql -u username -p database_name < file.sql
Thanks guys for pointing out that split was not the way to go!
Instead I managed to upload the original 120Mb file by editing the following limits before restarting MAMP:
In MAMP/bin/php/php5.4.10/conf/php.ini I changed the memory_limit to 200M, the post_max_size to 200M and the upload_max_filesize to 120M.
I then copied MAMP/Library/support-files/my-large.cnf to MAMP/Library and renamed it to my.cnf before setting max_allowed_packet to 100M
Was pointed in this direction MAMP FAQs and https://stackoverflow.com/a/13613140/767761

mysql syntax error: 'USING BTREE ) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 AUTOINCREMENT='

Im getting this error:
CREATE TABLE `pdc5l_usergroups` (
`id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`parent_id` int( 10 ) unsigned NOT NULL DEFAULT '0' COMMENT 'ID Lista de referencia adyacente',
`lft` int( 11 ) NOT NULL DEFAULT '0' COMMENT 'Anidadas conjunto lft.',
`rgt` int( 11 ) NOT NULL DEFAULT '0' COMMENT 'Anidadas conjunto rgt.',
`title` varchar( 100 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `id` ) ,
UNIQUE KEY `idx_usergroup_parent_title_lookup` ( `parent_id` , `title` ) ,
KEY `idx_usergroup_title_lookup` ( `title` ) ,
KEY `idx_usergroup_adjacency_lookup` ( `parent_id` ) ,
KEY `idx_usergroup_nested_set_lookup` ( `lft` , `rgt` ) USING BTREE
) ENGINE = MYISAM AUTO_INCREMENT =9 DEFAULT CHARSET = utf8AUTOINCREMENT =9;
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 'USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 AUTOINCREMENT=' at line 11
I have tried these:
) ENGINE = MYISAM AUTO_INCREMENT =9 DEFAULT CHARSET = utf8 AUTO_INCREMENT =9;
) ENGINE = MYISAM AUTOINCREMENT =9 DEFAULT CHARSET = utf8 AUTOINCREMENT =9;
) ENGINE = MYISAM AUTOINCREMENT =9 DEFAULT CHARSET = utf8 AUTO_INCREMENT =9;
but I still get the error.
phpmyadmin says this: MySQL client version: 4.1.22
This is a mysql version problem. You can see the issue in that bug:
http://bugs.mysql.com/bug.php?id=25162
Before MySQL 5.0.60, this option can be given only before the ON
tbl_name clause. Use of the option in this position is deprecated as
of 5.0.60 and support for it there will be removed in a future MySQL
release. If an index_type option is given in both the earlier and
later positions, the final option applies.
TYPE type_name is recognized as a synonym for USING type_name.
However, USING is the preferred form.
For more details see here: http://www.dbforums.com/mysql/1617755-using-btree.html

Wordpress PhpMyAdmin import db error

Im trying to move my wordpress site over to another hosting. I have exported the db and I am re-importing it onto the hosting. The database does have a different name but I have updated the file.
Here is the error I receive when trying to import it:
Error
SQL query:
CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
`meta_id` bigint( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
`comment_id` bigint( 20 ) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar( 255 ) DEFAULT NULL ,
`meta_value` longtext,
PRIMARY KEY ( `meta_id` ) ,
KEY `comment_id` ( `comment_id` ) ,
KEY `meta_key` ( `meta_key` )
) TYPE = MYISAM AUTO_INCREMENT =17;
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 AUTO_INCREMENT=17' at line 9
I had a look on here and a lot of people said it was because Add CREATE PROCEDURE / FUNCTION / EVENT statement needed ticking, but I have done this.
As documented under CREATE TABLE Syntax:
Note
The older TYPE option was synonymous with ENGINE. TYPE was deprecated in MySQL 4.0 and removed in MySQL 5.5. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead.
Therefore, you want:
CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
`meta_id` bigint( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
`comment_id` bigint( 20 ) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar( 255 ) DEFAULT NULL ,
`meta_value` longtext,
PRIMARY KEY ( `meta_id` ) ,
KEY `comment_id` ( `comment_id` ) ,
KEY `meta_key` ( `meta_key` )
) ENGINE = MYISAM AUTO_INCREMENT =17;