@@ -13,25 +13,39 @@ if [ ! -z "${DB}" ]; then
13
13
docker run -it --name=mysqld -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}
14
14
sleep 10
15
15
16
+ mysql () {
17
+ docker exec mysqld mysql " ${@ } "
18
+ }
16
19
while :
17
20
do
18
21
sleep 5
19
- mysql -uroot -h 127.0.0.1 -P 3306 - e ' select version()'
22
+ mysql -e ' select version()'
20
23
if [ $? = 0 ]; then
21
24
break
22
25
fi
23
26
echo " server logs"
24
27
docker logs --tail 5 mysqld
25
28
done
26
29
27
- echo -e " [client]\nhost = 127.0.0.1\n" > " ${HOME} " /.my.cnf
28
-
29
30
mysql -e ' select VERSION()'
30
- mysql -uroot -e ' create database test1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
31
- mysql -uroot -e ' create database test2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
32
31
33
- mysql -u root -e " create user test2 identified by 'some password'; grant all on test2.* to test2;"
34
- mysql -u root -e " create user test2@localhost identified by 'some password'; grant all on test2.* to test2@localhost;"
32
+ if [ $DB == ' mysql:8.0' ]; then
33
+ WITH_PLUGIN=' with mysql_native_password'
34
+ mysql -e ' SET GLOBAL local_infile=on'
35
+ docker cp mysqld:/var/lib/mysql/public_key.pem " ${HOME} "
36
+ docker cp mysqld:/var/lib/mysql/ca.pem " ${HOME} "
37
+ docker cp mysqld:/var/lib/mysql/server-cert.pem " ${HOME} "
38
+ docker cp mysqld:/var/lib/mysql/client-key.pem " ${HOME} "
39
+ docker cp mysqld:/var/lib/mysql/client-cert.pem " ${HOME} "
40
+ else
41
+ WITH_PLUGIN=' '
42
+ fi
43
+
44
+ mysql -uroot -e ' create database test1 DEFAULT CHARACTER SET utf8mb4'
45
+ mysql -uroot -e ' create database test2 DEFAULT CHARACTER SET utf8mb4'
46
+
47
+ mysql -u root -e " create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
48
+ mysql -u root -e " create user test2@localhost identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2@localhost;"
35
49
36
50
cp .travis/docker.json pymysql/tests/databases.json
37
51
else
0 commit comments