Skip to content

Instantly share code, notes, and snippets.

@sowawa
Created March 19, 2012 07:06
Show Gist options
  • Save sowawa/2100153 to your computer and use it in GitHub Desktop.
Save sowawa/2100153 to your computer and use it in GitHub Desktop.
Mysql initialize on rackhub

Initialize mysql.

#!/bin/bash
cd
# stop mysql
sudo /usr/local/mysql/mysql.server stop
MYSQL_DIR=/usr/local/mysql-5.6.5-m8
MYSQL_DATA_DIR=$MYSQL_DIR/data
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 $MYSQL_DIR/mysql.server start
# set mysql password
sudo $MYSQL_DIR/bin/mysqladmin -u root password 'loverackhub'
# restart mysql
sudo $MYSQL_DIR/mysql.server restart
@sowawa
Copy link
Author

sowawa commented Jun 9, 2012

15行目に ps aux | grep mysqld をしてみたのですが

Starting MySQL
. * 
root     30210  1.0  0.2   4392   736 pts/0    S+   10:19   0:00 /bin/sh /usr/local/mysql-5.6.5-m8/bin/mysqld_safe --datadir=/usr/local/mysql-5.6.5-m8/data --pid-file=/usr/local/mysql-5.6.5-m8/data/sowawa2.rackbox.net.pid
mysql    30569  3.0  5.8 190400 14472 pts/0    Sl+  10:19   0:00 /usr/local/mysql-5.6.5-m8/bin/mysqld --basedir=/usr/local/mysql-5.6.5-m8 --datadir=/usr/local/mysql-5.6.5-m8/data --plugin-dir=/usr/local/mysql-5.6.5-m8/lib/plugin --user=mysql --log-error=/usr/local/mysql-5.6.5-m8/data/sowawa2.rackbox.net.err --pid-file=/usr/local/mysql-5.6.5-m8/data/sowawa2.rackbox.net.pid --socket=/tmp/mysql565.sock --port=3306
root     30592  0.0  0.3  10328   924 pts/0    S+   10:19   0:00 grep mysqld
Shutting down MySQL
. * 
Starting MySQL
. * 

となったのでrootでは動いてないですね。

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