系统介绍:centos 6.4 mysql:5.5
#查看磁盘并配置一块lvs磁盘方便后续db文件空间不够的问题
fdisk -l | grep "^Disk /dev/*" vgs pvcreate /dev/sdd vgcreate mysqldb /dev/sdd lvcreate -n mysqldba -L 99.9G mysqldb lvs
#创建mysql安装目录
mkdir /mysqldata
# 创建mysql user
groupadd mysql -g 3000 useradd -g 3000 -u 3000 -r -s /sbin/nologin mysql
#设置mysql 目录
mkdir /usr/loca/mysql chown mysql.mysql !$
# 下载mysql 二进制安装文件包
cd !$ wget http://cdn.mysql.com//archives/mysql-5.5/mysql-5.5.32-linux2.6-x86_64.tar.gz ./scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/mysqldata/data/ --user=mysql
# mysql 启动文件
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig mysqld on
# 设置my.cnf文件
mv /etc/my.cnf{,.bak} cp my-small.cnf /etc/my.cnf vim /etc/my.cnf [mysqld] basedir=/usr/local/mysql/ datadir=/mysqldata/data/ port = 3306 server-id = 1 log-bin=/mysqldata/bin_log/bin_log_master binlog_format=mixed
# 配置mysql bin启动以及帮助文件
vim /etc/profile.d/mysqld.sh export PATH=$PATH:/usr/local/mysql/bin vim /etc/man.config MANPATH /usr/local/mysql/man
# 后续请将mysql安装目录/usr/local/mysql/,/mysqldata/data/ 都有mysql.mysql权限
然后启动mysql就成了
时间: 2024-11-09 12:34:48