mysql 5.5 安装部署
mysql5.5放弃了原来的autoconf编译方式,改用cmake。
1.先下载cmake
http://www.cmake.org
编译安装./configure;make;make install
2.解压mysql,然后进入mysql包目录:
文档说有三个参数:
* -DBUILD_CONFIG=mysql_release: Configure the source with the
same build options used by Oracle to produce binary
distributions for official MySQL releases.
* -DCMAKE_INSTALL_PREFIX=dir_name: Configure the distribution
for installation under a particular location.
* -DCPACK_MONOLITHIC_INSTALL=1: Cause make package to generate a
single installation file rather than multiple files.
* -DWITH_DEBUG=1: Build the distribution with debugging support.
我只指定了prefix:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql .
make
make install
安装完毕
cp /root/mysql/support-files/my-large.cnf /etc/my.cnf
cp /root/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
修改/etc/rc.d/init.d/mysqld
basedir=/usr/local/mysql
datadir=/home/mysql/data(例如你的数据目录在/home/mysql/下)
到你准备生成mysqldatadir的目录里执行:/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql
启动mysql:/usr/local/mysql/bin/mysqld_safe --user=mysql &
设置密码
mysqladmin -u root password 'yourpass'
mysql -u root
flush privileges;
设置系统级别3的时候,自动启动mysqld
chkconfig --level 3 mysqld on
设置环境变量
# PATH=$PATH:/usr/local/mysql/bin
# export PATH
# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
# ldconfig