While importing mysqldump file ERROR 1064 (42000) near ' ■/ ' at line 1

后端 未结 3 1019
陌清茗
陌清茗 2021-01-31 05:03

Cannot import the below dump file created by mysqldump.exe in command line of windows

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET         


        
3条回答
  •  囚心锁ツ
    2021-01-31 05:35

    Finally I got a solution

    We need two options

    • --default-character-set=utf8: This insures UTF8 is used for each field
    • --result-file=file.sql: This option prevents the dump data from passing through the Operating System which likely does not use UTF8. Instead it passes the dump data directly to the file specified.

    Using these new options your dump command would look something like this:

    mysqldump -u root -p --default-character-set=utf8 --result-file=database1.backup.sql database1
    

    While Importing you can optionally use:

    mysql --user=root --password=root --default_character_set utf8 < database1.backup.sql
    

    Source:http://nathan.rambeck.org/blog/1-preventing-encoding-issues-mysqldump

提交回复
热议问题