"Invalid UTF8 line" when importing mysqldump

I'm trying to import a mysqldump script into google cloud SQL and the process is failing with the error "Invalid UTF8 line" at a given line in my script

The script can be imported on my local MySQL instance with no problem I exported my structure & date using following command line : mysqldump -umyUser -p --routines --all-databases -r /tmp/mysqldump.sql

And my server is set to UTF8 (at the beginning of the sql file, I have :

-- MySQL dump 10.13  Distrib 5.1.73, for redhat-linux-gnu (x86_64)
--
-- Host: localhost    Database:
-- ------------------------------------------------------
-- Server version   5.1.73-log

/*!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 */;

Any idea about what is going bad about the file encoding ?

Upvotes: 0

Views: 491

Answers (1)

m00
m00

Reputation: 286

When you receive an error such as ‘invalid UTF8 line’ error, this generally means that the values that you are inserting are not in UTF8 format.

I recommend retrying the export and using the following flags: ‘--hex-blob’ and ‘'--default-character-set=utf8'. This is mentioned as a suggestion in the Cloud SQL FAQ under ‘Notable Differences’ between MySQL and Cloud SQL.

For a full list of mysqldump options, please see the documentation.

I hope that this information is helpful.

Upvotes: 2

Related Questions