Skip to content

Instantly share code, notes, and snippets.

@Baft
Forked from solar/install.sh
Last active August 29, 2015 14:26
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 Baft/bf8b58d6470cd6ecff46 to your computer and use it in GitHub Desktop.
Save Baft/bf8b58d6470cd6ecff46 to your computer and use it in GitHub Desktop.
install mysqld with supervisord
#!/bin/sh
sudo groupadd mysql
sudo mkdir -p /var/mysqld
sudo useradd -r -g mysql -M -d /var/mysqld mysql
sudo chown mysql:mysql /var/mysqld
sudo yum -y install cmake bison gcc-c++
curl -sL http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz | tar zx
cd mysql-5.5.28/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/5.5.28 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_bin
make
sudo make install
cd ../
sudo alternatives --install /usr/local/mysql/default mysql /usr/local/mysql/5.5.28 50528
sudo /usr/local/mysql/default/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/default --datadir=/var/mysqld/data
sudo mkdir -p /etc/supervisord.d
sudo cp ./mysqld.ini /etc/supervisord.d/
sudo cp ./my.cnf /etc/my.cnf
sudo supervisorctl reread mysqld
sudo supervisorctl add mysqld
[client]
port = 3306
socket = /var/mysqld/mysqld.socket
[mysqld]
port = 3306
socket = /var/mysqld/mysqld.socket
default-time-zone = '+00:00'
user = mysql
datadir = /var/mysqld/data
back_log = 100
max_connections = 100
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 2M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 16
thread_concurrency = 32
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
default-storage-engine = INNODB
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
# *** Binary logs
log-bin=mysql-bin
binlog_format=mixed
# *** Logging
log-error=/var/log/mysqld.log
slow_query_log
long_query_time = 2
# *** Replication related settings
server-id = 1
# *** MyISAM Specific options
key_buffer_size = 32M
bulk_insert_buffer_size = 16M
myisam_sort_buffer_size = 32M
myisam_max_sort_file_size = 256M
myisam_repair_threads = 1
myisam_recover
# *** INNODB Specific options ***
innodb_additional_mem_pool_size = 8M
innodb_buffer_pool_size = 1G
innodb_data_file_path = ibdata1:10M:autoextend
# Set this option if you would like the InnoDB tablespace files to be
# stored in another location. By default this is the MySQL datadir.
#innodb_data_home_dir = <directory>
innodb_write_io_threads = 8
innodb_read_io_threads = 8
#innodb_force_recovery=1
innodb_thread_concurrency = 32
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 1G
innodb_log_files_in_group = 3
#innodb_log_group_home_dir
innodb_max_dirty_pages_pct = 90
#innodb_flush_method=O_DSYNC
innodb_lock_wait_timeout = 120
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192
[program:mysqld]
command=/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/local/mysql/default/bin/mysqld_safe --pid-file=/var/mysqld/mysqld.pid
autostart=true
autorestart=true
user=root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment