关注于系统高可用、网站架构
分类: Mysql/postgreSQL
2010-03-17 10:40:26
cd bin
./mysqladmin -u root password 'password'
# To verify mysql installation
./mysqladmin -u root -ppassword version
./mysqladmin -u root -ppassword variables
# To make sure the mysql server could be shutdown and startup normally
./mysqladmin -u root -ppassword shutdown
cd /infowarelab/mysql
bin/mysqld_safe --user=mysql &
# Post-Installation: Start mysql automatically
cd bin
./mysqladmin -u root -ppassword shutdown
ps -ef | grep mysql
cp /infowarelab/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on
# Post-Installation: my.cnf configuration
# For <10.0.0.34>
cp /infowarelab/src/34.my.ini /etc/my.cnf
# For <10.0.0.35>
cp /infowarelab/src/35.my.ini /etc/my.cnf
# Restart the mysql instance
cd /infowarelab/mysql
bin/mysqld_safe --user=mysql &
ps -ef | grep mysql
FOR mysql5.5
创建用户组mysql和账号mysql
groupadd mysql
useradd –m –g mysql mysql
创建数据目录和日志目录
su – mysql
mkdir data logs
解压缩二进制包
tar zxvf mysql-5.5.39-linux2.6-x86_64.tar.gz -C /usr/local
mv /usr/local/mysql-5.5.39-linux2.6-x86_64/ /usr/local/mysql
cd /usr/local/
chown -R mysql:mysql mysql
拷贝配置文件并配置相关选项
cp /usr/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
增加配置选项:(和原有配置文件重复的,删除老的)
basedir=/usr/local/mysql
datadir=/home/mysql/data
character-set-server=utf8
log_bin=/home/mysql/logs/bin
binlog_format=ROW
innodb_data_home_dir=/home/mysql/data
innodb_data_file_path=ibdata1:2048M;ibdata2:2048M:autoextend
innodb_log_group_home_dir=/home/mysql/logs
innodb_log_file_size=1G
innodb_flush_method=O_DIRECT
innodb_file_per_table
删除innodb_log_file_in_group=3
初始化系统数据库
cd /usr/local
scripts/mysql_install_db --user=mysql --datadir=/home/mysql/data
拷贝启动脚本到服务列表
cp support-files/mysql.server /etc/init.d/mysql
ln -snf /usr/local/mysql/bin/* /usr/local/bin
启动mysql
service mysql start