Skip to content

Instantly share code, notes, and snippets.

@tomykaira
Forked from sowawa/README.md
Created June 9, 2012 07:16
Show Gist options
  • Save tomykaira/2899931 to your computer and use it in GitHub Desktop.
Save tomykaira/2899931 to your computer and use it in GitHub Desktop.
Mysql initialize on rackhub
#!/bin/sh
set -x
set -e
SERVER_COMMAND=/usr/local/mysql/mysql.server
MYSQL_DIR=/usr/local/mysql
MYSQL_DATA_DIR=$MYSQL_DIR/data
sudo $SERVER_COMMAND stop
sudo rm -rf $MYSQL_DATA_DIR
sudo mkdir $MYSQL_DATA_DIR
# set up mysql
sudo $MYSQL_DIR/scripts/mysql_install_db --user=mysql --basedir=$MYSQL_DIR --datadir=$MYSQL_DATA_DIR
# chmod mysql
sudo chown -R mysql:mysql $MYSQL_DATA_DIR
# start mysql
sudo $SERVER_COMMAND start
# set mysql password
sudo $MYSQL_DIR/bin/mysqladmin -u root password 'new-password'
# restart mysql
sudo $SERVER_COMMAND restart
@sowawa
Copy link

sowawa commented Jun 9, 2012

こっちにコメント書いておきました。
やっぱりユーザは指定しなくてもmysqlで動いているみたいです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment