-
-
Save tomykaira/2899931 to your computer and use it in GitHub Desktop.
Mysql initialize on rackhub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こっちにコメント書いておきました。
やっぱりユーザは指定しなくてもmysqlで動いているみたいです。