MySQL import/export version incompatibilty - mysql

I have taken a dump from my mysql database on my own server (version 5.0.67) and I have tried to import it to my other database (version 5.0.54). However, I get the error:
ERROR 1193 (00000) at line 23: Unknown system variable 'character_set_client'
I think it refers to this part:
SET #saved_cs_client = ##character_set_client;
SET character_set_client = utf8;
I have tried removing all the above lines but that made the error worse:
ERROR 1064 (00000) at line 23: 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 'DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 10240 kB; (`member
Any help would be greatly appreciated.
UPDATE
I used the compatibility option like so but when importing I still get the same error!? WTF
mysqldump -u root -p dbname --compatible=mysql40 > mrdb.sql

If you're using mysqldump to do the data dump, then there's a --compatibility option which you can set to some earlier version. 5.0.54 is kinda buggy so upgrade that beast when you have a chance.

If you install phpMyAdmin, you can use it to export the database. When you click 'Export' you will see an option for 'compatibly mode' where you can select MySQL 4 and 3.

Mightn't the order of the variables be wrong? Just a guess.
SET character_set_client = utf8;
SET #saved_cs_client = ##character_set_client;

Related

Dump file error while trying to switch to import to a MySQL

I have a dump file name mydata.dump.sql. Currently using a console of my MYSQL database. To use my data I have tried the source command:
source mydata.dump.sql
I am however getting 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 'TRANSACTION' at line 7
Query OK, 0 rows affected (0.00 sec)
Not sure what' s wrong with that syntax but the dump file was generated by phpmyadmin, so I guessed it was legit.
Here an excerpt from the dump file that shows line 7 :
----
-- phpLiteAdmin database dump (http://www.phpliteadmin.org/)
-- phpLiteAdmin version: 1.9.7-dev
-- Exported: 10:39pm on May 20, 2017 (UTC)
-- database file: /home/ubuntu/workspace/finale.db
----
BEGIN TRANSACTION;
COMMIT;
In command line you can use:
mysql -u your_username -p database_name < mydata.dump.sql
If you are on windows put full path
USE your db_name;
SOURCE D:/yourfolder/mydata.dump.sql;
Try to replace the name mydata.dump.sql to mydata_dump.sql
Some times also for me phpmyadmin got strange errors.
Many people recommend to use mysqldump to export and then mysql ... to import

Unknown character set: 'utf8mb4'

im trying to upload my first wordpress website. Im using the local wordpress.org php my admin and the php my admin from 000webhost. Ive researched this a a lot here and changed all the settings people were saying from utf8mb4 to utf8 but it only caused more errors. I changed everything back to what it was (at least i think so and the error is the same as the beginning now). Anyone knows how i can get around this and import my db to 000.webhost with no errors? the Error is SQL query:
/*!40101 SET NAMES utf8mb4 */;
and
MySQL said: Documentation
1115 - Unknown character set: 'utf8mb4'
1) The first: If you can control ssh server. Please update mysql version. Your mysql too old. Maybe < 5.5.3.
2) The second: If you can't access ssh. Try to export your database with Mysql version 4.0.
With command line mysqldump --compatible=mysql40 -u user -p DB > dumpfile.sql
With web access phpmyadmin -> Select Database -> Export -> Custom - display all possible options -> Format-specific options ->
Database system or older MySQL server to maximize output compatibility with: Select MYSQL40.
Change content file .sql you exported
/*!50003 SET character_set_client = utf8mb4 */ ;
to utf8 only.
And replace by Ctrl H in Sublime change all from utf8mb4 => utf8
Hope this helps.
Just modify this into mysql Database.
wrong that modify ..... /*!40101 SET NAMES utf8mb4 /;
now corrected ..... /!40101 SET NAMES utf8 */;
just erase .... mb4 ....
its work now

Error 1193 when following 'employees database' install tutorial with MySQL 5.7.11

I downloaded and installed a vanilla instance of MySQL 5.7.11 (that's the version it reports when I run > mysql -v). The instance is up and running.
Then I tried to follow the seemingly simple tutorial here:
https://dev.mysql.com/doc/employee/en/employees-installation.html
When I get to the step to run: mysql -t < employees.sql it fails, giving the error:
ERROR 1193 (HY000) at line 38: Unknown system variable 'storage_engine'
The employees.sql file is configured as instructed in the tutorial with the default setting. How do I fix this error?
Note: I'm performing all steps as root in MySQL, and the system is Win10 if that has any bearing.
The tutorial hasn't been updated to reflect changes in recent MySQL versions. From the documentation
This variable is deprecated and was removed in MySQL 5.7.5. Use default_storage_engine instead.
If anyone cares to know the fix without finding the updated archive it's relatively simple:
Open the employees.sql file in your editor of choice
Edit lines 38 and 44
// change line 38 from:
set storage_engine = InnoDB;
// to:
set default_storage_engine = InnoDB;
// change line 44 from:
select CONCAT('storage engine: ', ##storage_engine) as INFO;
// to:
select CONCAT('default storage engine: ', ##default_storage_engine) as INFO;
Save employees.sql, then open a console window and navigate to the employees_db folder. Execute the following command from the prompt and your all set.
c:\employees_db>c:\Path\to\MySql\bin\mysql.exe -u username -p < employees.sql
[root#001 employees_db]# vim employees.sql
set **default_storage_engine** = InnoDB;
-- set storage_engine = MyISAM;
-- set storage_engine = Falcon;
-- set storage_engine = PBXT;
-- set storage_engine = Maria;
select CONCAT('storage engine: ', ##**default_storage_engine**) as INFO;
Two changes needed : default_storage_engine
Updated db is available in https://github.com/datacharmer/test_db
It has the fix for MySQL 5.7.x
no its not fix in a new version... I got the same error:
ERROR 1193 (HY000) at line 38: Unknown system variable 'storage_engine'

Error importing SQL DB in phpMyAdmin "#1064 You have an error in your SQL syntax - Host: lo' at line 1"

I used this exported DB to move from one HostGator (call it A) account to another (call it B) about a year+ ago. I'm cleaning up a hacked website mess on HostGator account B so I'm restoring this website from my original files (from HostGator A) on my computer to another HostGator (call it C) account.
I vaguely remember having an issue when I tried to import them to HostGator B - and the chat tech and I came to the conclusion that when I was exporting from HostGator A my computer was saving it but also opening it in NotePad and from there I was saving it to the directory I wanted. I seem to recall him saying something about a space or character or something. I uploaded the .sql file and he fixed it and imported it.
I've been on chat tech with HostGator today for going on 3 hours. :-\
Error:
SQL query:
phpMyAdmin SQL Dump
-- version 3.5.5
-- phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 30, 2014 at 12:53 PM
-- Server version: 5.5.33-31.1
-- PHP Version: 5.4.23
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
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 'phpMyAdmin SQL Dump
-- version 3.5.5
-- phpmyadmin.net
--
-- Host: lo' at line 1
Here are the first few lines:
-- phpMyAdmin SQL Dump
-- version 3.5.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 30, 2014 at 12:53 PM
-- Server version: 5.5.33-31.1
-- PHP Version: 5.4.23
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET #OLD_CHARACTER_SET_CLIENT=##CHARACTER_SET_CLIENT */;
/*!40101 SET #OLD_CHARACTER_SET_RESULTS=##CHARACTER_SET_RESULTS */;
/*!40101 SET #OLD_COLLATION_CONNECTION=##COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: <code>hosting_NameChangedForThisPost</code>
--
--
Your query is missing the comment delimiter -- on the first line. This is why it's telling you there's an error "near 'phpMyAdmin SQL Dump". Make sure when you're copying and pasting that you're not missing the first couple of characters.
in this case, Instead of importing teh .sql. Go to your phpmysql and click on SQL.
Then open your .sql file you want to import in notepad. copy and paste .
In this way you will avoid the importing process removing the comment delimiter -- on the first line. T

MySQL UTF8 Windows export - Linux import

I have MySQL database version 5.1.36, that came with WAMP installation. I used it for development purposes on Windows XP SP3, and it has some data in it, which is cyrillic, and the collation for all of those tables/columns is set to utf8_general_ci.
Now the time has come to move this database to pseudo-production environment, which is on Debian Lenny. Version of MySQL here is 5.0.51a.
I tried the following:
I exported the databse with data from phpmyadmin on Windows and saved the .sql file to be in UTF8.
Then, I transferred it through WinSCP (both with default and binary transfer settings) to Linux machine.
I created the database through command line: mysqladmin -u root -p create nbs
Finally, I tried to create tables and fill the data:
mysql -u root -p --default-character-set=utf8 nbs < NBS_utf8_1.sql
However, this is where I'm getting the error, like:
ERROR 1064 (42000) at line 1: 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 '
CREATE TABLE IF NOT EXISTS `history_members` (
`id` int(11) NOT NULL AUTO_' at line 1
Something is messed up with encoding, I suppose... but don't know how and where. I think I read in the similar question on SO that binary mode for text transfer will only change the line breaks CRLF to LF (don't know if this is correct...). What am I missing here?
Thanks.
For this particular case, the problem was solved with the following modifications:
1) I set initial collation while creating the target database to utf8_general_ci,
2) I transferred the file with text mode through WinSCP,
3) I added SET NAMES 'utf8' COLLATE 'utf8_general_ci'; to the top of sql dump.
Here is what I found using PhpMyAdmin for a rough SQL import using remote shell :
/*!40101 SET #OLD_CHARACTER_SET_CLIENT=##CHARACTER_SET_CLIENT */;
/*!40101 SET #OLD_CHARACTER_SET_RESULTS=##CHARACTER_SET_RESULTS */;
/*!40101 SET #OLD_COLLATION_CONNECTION=##COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;