使用mysql二进制包安装mysql5.5

时间:2021-07-10 20:00:25
下载mysql

在http://dev.mysql.com/downloads/mysql/官网上下载mysql-5.5.30-linux2.6-x86_64.tar.gz
mysql-5.5.30-linux2.6-x86_64.tar.gz
cp -rf mysql-5.5.30-linux2.6-x86_64 /usr/local/mysql


配置用户,目录

groupadd mysql
useradd -r -g mysql mysql
chown -R mysql:mysql /usr/local/mysql

初始化mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data

cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

启动mysql

常用的mysql启动参数:
/usr/local/mysql/bin/mysqld  --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  --port=3306 --socket=/tmp/mysql.sock

推荐启动
service mysqld start|stop|restart