wget http://101.96.10.42/dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.53-linux2.6-x86_64.tar.gz
groupadd -r mysql
useradd -g mysql -r -s /sbin/nologin mysql
id mysql
uid=498(mysql) gid=499(mysql) groups=499(mysql)
tar zxvf mysql-5.5.53-linux2.6-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -sv mysql-5.5.53-linux2.6-x86_64 mysql
cd mysql
chown -R mysql.mysql .
mkdir /home/data
chown -R mysql.mysql /home/data
./scripts/mysql_install_db --datadir=/home/data --user=mysql
chown -R root .
chown -R mysql.mysql /home/data
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
cp support-files/my-medium.cnf /etc/my.cnf
vi /etc/my.conf
添加:
datadir = /home/data
# Try number of CPU‘s*2 for thread_concurrency
thread_concurrency = 40
设置环境变量
vi /etc/profile.d/mysql
export PATH=/usr/local/mysql/bin:$PATH
读取环境变量
. /etc/profile.d/mysql
启动
service mysqld start
关闭:
mysqladmin shutdown
mysqladmin -uroot -p
原文:http://12223582.blog.51cto.com/12213582/1876180