MySQL ERROR 1231 (42000):Variable 'character_set_client' can't be set to the value of 'NULL'

后端 未结 6 1285
陌清茗
陌清茗 2020-12-12 16:47

I\'ve a MySQL 5.0.84 running in a Slackware 13.0 Staging server and wanted to copy a single table to another server which was built to use Ubuntu 1

相关标签:
6条回答
  • 2020-12-12 16:58

    I did some search in internet and fixed it finally.

    Added the following text at the beginning of the mysqldump file and the restore was successful.

    /*!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 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE='+00:00' */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    
    0 讨论(0)
  • 2020-12-12 16:59

    Try to make the maximum allowed packet size arbitrarily high temporarily by typing in:

    mysql> set global max_allowed_packet=10000000000;
    

    /via http://injustfiveminutes.com/2013/02/14/errors-restoring-mysql-database-dump-on-wamp-environment/

    0 讨论(0)
  • 2020-12-12 17:01

    I have modified

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

    to

    /*!40101 SET character_set_client = 'utf8' */;
    

    in the dump file after the code for creating table.

    0 讨论(0)
  • 2020-12-12 17:05

    on my way,open the .sql file,in the end ,do del:

      /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
      /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
      /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    

    and source it again,then work well for me!

    0 讨论(0)
  • Well, thanks to all the answers, It just helped me solving my issue. But copying and pasting codes from above didn't work for me. So, I exported sql file which was already in my database and from there I took the code and added the following to the beginning of my sql file to import

    -- phpMyAdmin SQL Dump
    -- version 4.7.0
    -- https://www.phpmyadmin.net/
    --
    -- Host: 127.0.0.1
    -- Generation Time: Aug 16, 2017 at 07:24 AM
    -- Server version: 10.1.25-MariaDB
    -- PHP Version: 7.1.7
    
    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET AUTOCOMMIT = 0;
    START TRANSACTION;
    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 utf8mb4 */;
    

    Because this top section was missing in my sql document. Then the import was successful. I hope this helps someone else too.

    0 讨论(0)
  • 2020-12-12 17:22

    I changed from

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    

    to

    /*!40101 SET CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    

    it worked for me

    0 讨论(0)
提交回复
热议问题