Skip to content

Instantly share code, notes, and snippets.

@pyama86
Last active July 22, 2019 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyama86/9ac90b14e73932dbc573703c9afa90cd to your computer and use it in GitHub Desktop.
Save pyama86/9ac90b14e73932dbc573703c9afa90cd to your computer and use it in GitHub Desktop.
mysqlのinformation schemaの律速問題

dockerはこの世に叡智をもたらした

# straceとかうちたいから特権与える
$ docker run --rm --privileged -it -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 mysql:5.7

大量にDB創る

$ mysql -uroot -h127.0.0.1 -P3306 -e "CREATE USER 'user'@'%' IDENTIFIED BY 'test';"
$ seq 1 10000 | xargs -I ZZ -P 10 sh -c "mysql -uroot -h127.0.0.1 -P3306 -e \"CREATE DATABASE IF NOT EXISTS dbZZ;\" && \
  mysql -uroot -h127.0.0.1 -P3306 -e \"GRANT ALL PRIVILEGES ON dbZZ.* TO 'user'@'%';\" && \
  mysql -uroot -h127.0.0.1 -P3306 -e \"FLUSH PRIVILEGES;\""
$ mysql -h 127.0.0.1 -P3306 -uuser -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment