Skip to content

Instantly share code, notes, and snippets.

@wteuber
Forked from cemeng/mysql-install.sh
Created May 28, 2019 07:53
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 wteuber/642f1a6e5dd51b52744eaae711730f5d to your computer and use it in GitHub Desktop.
Save wteuber/642f1a6e5dd51b52744eaae711730f5d to your computer and use it in GitHub Desktop.
Codeship Install MySQL 5.6
#!/bin/bash
# Install a custom MySQL 5.7 version - https://www.mysql.com
#
# To run this script on Codeship, add the following
# command to your project's setup commands:
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/mysql-5.7.sh | bash -s
#
# Add the following environment variables to your project configuration
# (otherwise the defaults below will be used).
# * MYSQL_VERSION
# * MYSQL_PORT
#
MYSQL_VERSION=${MYSQL_VERSION:="5.6.43"}
MYSQL_PORT=${MYSQL_PORT:="3307"}
MYSQL_DL_URL="https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz"
set -e
MYSQL_DIR=${MYSQL_DIR:=$HOME/mysql-$MYSQL_VERSION}
CACHED_DOWNLOAD="${HOME}/cache/mysql-${MYSQL_VERSION}.tar.gz"
mkdir -p "${MYSQL_DIR}"
wget --continue --output-document "${CACHED_DOWNLOAD}" "${MYSQL_DL_URL}"
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${MYSQL_DIR}"
mkdir -p "${MYSQL_DIR}/data"
mkdir -p "${MYSQL_DIR}/data/mysql"
mkdir -p "${MYSQL_DIR}/socket"
mkdir -p "${MYSQL_DIR}/log"
echo "#
# The MySQL 5.7 database server configuration file.
#
[client]
port = ${MYSQL_PORT}
socket = ${MYSQL_DIR}/socket/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = ${MYSQL_DIR}/socket/mysqld.sock
nice = 0
[mysqld]
user = rof
pid-file = ${MYSQL_DIR}/mysqld.pid
socket = ${MYSQL_DIR}/socket/mysqld.sock
port = ${MYSQL_PORT}
basedir = ${MYSQL_DIR}/data
datadir = ${MYSQL_DIR}/data/mysql
tmpdir = /tmp
lc-messages-dir = ${MYSQL_DIR}/share/english
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
# * Fine Tuning
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
innodb_use_native_aio = 0
# * Query Cache Configuration
query_cache_limit = 1M
query_cache_size = 16M
# * Logging and Replication
log_error = ${MYSQL_DIR}/log/error.log
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
" > "${MYSQL_DIR}/my.cnf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment