Mysql脚本备忘

#
# Installation script
#
# Prepare for compilation environment
yum install -y groupinstall "Development Tools"

# Create a build directory
mkdir -p /opt/install/mysql

# Prepare for compilation source
cd /opt/install/mysql
curl -o mysql-5.5.24.tar.gz http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5/mysql-5.5.24.tar.gz
tar -zxvf mysql-5.5.24.tar.gz

# Install build dependencies
yum install -y cmake ncurses-devel

# Create a User Group
groupadd mysql
useradd -r -g mysql mysql

# Compile and deploy
cd mysql-5.5.24
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/server/database/mysql \
-DSYSCONFDIR=/opt/server/database/mysql/conf \
-DMYSQL_UNIX_ADDR=/opt/server/database/mysql/tmp/mysql.sock \
-DMYSQL_DATADIR=/opt/server/database/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_DEBUG=OFF \
-DMYSQL_USER=mysql
make
make install

# Postinstallation setup
cd /opt/server/database/mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data

# Configuration
mkdir -p conf
cp support-files/my-medium.cnf conf/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
chmod a+x /etc/init.d/mysql
##chkconfig --add mysql
##chkconfig --level 345 mysql on

# Additional
/etc/init.d/mysql start
bin/mysqladmin -u root password "****"
/etc/init.d/mysql stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值