Last active
July 6, 2020 19:30
-
-
Save uzimith/2bb9d858ed55f032c4d90b5b8df1b123 to your computer and use it in GitHub Desktop.
mysql 5.6.45以上で挿入できない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
docker run --name tmp-mysql -d --rm \ | |
-p 13306:3306 \ | |
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes -e MYSQL_DATABASE=tmp -v $(pwd):/fixture mysql:5.6.45 \ | |
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --sql-mode=TRADITIONAL,NO_AUTO_VALUE_ON_ZERO,ONLY_FULL_GROUP_BY --secure-file-priv="" | |
while ! mysqladmin ping -s -u root -P 13306 -h 0.0.0.0; do | |
printf . | |
sleep 1 | |
done | |
echo "" | |
echo "1,あああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああaあああああああああああああ" > tmp.tsv | |
echo "CREATE TABLE tmp (id bigint(20) NOT NULL, input text NOT NULL, PRIMARY KEY (id));" | mysql -u root -P 13306 -h 0.0.0.0 tmp | |
echo "LOAD DATA INFILE '/fixture/tmp.tsv' REPLACE INTO TABLE tmp FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';" | mysql -u root -P 13306 -h 0.0.0.0 tmp | |
echo "SELECT * FROM tmp;" | mysql -u root -P 13306 -h 0.0.0.0 tmp | |
docker stop tmp-mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment