Skip to content

Commit

Permalink
added my.cnf performance option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschwenn committed Sep 19, 2013
1 parent 20cd843 commit c2d816c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
12 changes: 12 additions & 0 deletions mmvMySQL/mmvmysql-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
MySQL is not installed by default on OS X 10.7 or newer. This script will fix that bug.

#WHAT THIS SCRIPT DOES
+ Checks for OS X and MySQL
+ Downloads MySQL from Oracle
+ Installs MySQL and the bits required to make it start by default
+ Sets some paths
+ Sets a default root password
+ Give the option to load a basic performance my.cnf and restart MySQL

#INSTALLATION
+ Open Terminal and run the following command
Expand All @@ -19,3 +21,13 @@ MySQL is not installed by default on OS X 10.7 or newer. This script will fix t
+ Click to install the MySQL preference pane when prompted.
+ Close your terminal and open a new terminal to access MySQL via command line
+ Install [Sequel Pro](http://www.sequelpro.com/) or phpmyadmin to manage MySQL

#FORGOT YOUR PASSWORD?
This script will restart MySQL, reset the password, and then restart it again

bash <(curl -Ls http://git.io/9xqEnQ)

#TUNING
This script creates a modified my.cnf file named mmv.cnf. The performance settings will not be perfect for every MySQL server. The intention was to give a small perfomance boost in a generic way. This script gives the option to copy over the mmv.cnf file to /etc/my.cnf and restart MySQL. We encourge you to further tune your MySQL server after it is running for awhile. You can do so by running this command in your terminal and it will display stats and recommendations. (Credit Major Hayden for MySQLTuner)

perl <(curl -Ls https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl)
7 changes: 3 additions & 4 deletions mmvMySQL/mmvmysql-passreset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# AUTHOR: JONATHAN SCHWENN @JONSCHWENN #
# MAC MINI VAULT - MAC MINI COLOCATION #
# MACMINIVAULT.COM - @MACMINIVAULT #
# VERSION 1.00 RELEASE DATE AUG 08 2013 #
# DESC: SCRIPT RESETS PASS FOR MySQL on OSX #
# VERSION 1.01 RELEASE DATE SEPT 18 2013 #
# DESC: SCRIPT RESETS PASS FOR MySQL on OSX #
#############################################
#REQUIREMENTS:
# OS X 10.7 or newer
Expand All @@ -22,8 +22,7 @@ echo $mypass > ~/Desktop/MYSQL_PASSWORD
echo "Setting MySQL root Password to $mypass"
echo "Placing password on desktop..."
/usr/local/mysql/bin/mysql -uroot -e "UPDATE mysql.user SET Password=PASSWORD('$mypass') WHERE User='root'; FLUSH PRIVILEGES;"
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server restart

else
"SORRY, MySQL IS NOT RUNNING ... THERE MUST BE A PROBLEM"
Expand Down
33 changes: 32 additions & 1 deletion mmvMySQL/mmvmysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# AUTHOR: JONATHAN SCHWENN @JONSCHWENN #
# MAC MINI VAULT - MAC MINI COLOCATION #
# MACMINIVAULT.COM - @MACMINIVAULT #
# VERSION 1.03 RELEASE DATE SEP 16 2013 #
# VERSION 1.04 RELEASE DATE SEP 18 2013 #
# DESC: THIS SCRIPT INSTALLS MySQL on OSX #
#############################################
#REQUIREMENTS:
Expand Down Expand Up @@ -68,6 +68,37 @@ cd ~/
hdiutil detach -quiet /Volumes/mysql-5.6.13-osx10.7-x86_64/
sleep 2
rm ~/Downloads/MySQL.dmg
# NEW MY.CNF PERFORMANCE OPTION START
echo "BASE PERFORMANCE MY.CNF IS JUST A GENERIC SUGGESTION FOR PERFORMANCE"
echo "YOUR RESULTS MAY VARY AND YOU MAY WANT TO FURTHER TUNE YOUR MY.CNF SETTINGS"
echo "..."
sudo cp /usr/local/mysql/my.cnf /usr/local/mysql/mmv.cnf
sudo tee -a /usr/local/mysql/mmv.cnf > /dev/null << EOF
# CUSTOMIZED BY MMVMySQL SCRIPT - JUST GENERIC SETTINGS
# DO NOT TREAT AS GOSPEL
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 4
EOF
while true; do
read -p "DO YOU WANT TO LOAD A BASE PERFORMANCE MY.CNF FILE? [y/N]" cnf
case $cnf in
[Yy]* ) sudo cp /usr/local/mysql/mmv.cnf /etc/my.cnf; sudo /usr/local/mysql/support-files/mysql.server restart; break ;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
# NEW MY.CNF PERFORMANCE OPTION END
echo "ALL DONE! Install Sequel Pro or phpmyadmin to administer MySQL"
echo "Log off and log back in for 'mysql' to be recognized as a command in terminal"
else
Expand Down

0 comments on commit c2d816c

Please sign in to comment.