MySQL5.5安装
1.安装cmake
# cd/usr/local/src/tarbag
# wget -c http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
# tar zxvf cmake-2.8.3.tar.gz -C ../software
# cd ../software/cmake-2.8.3
# ./bootstrap
# make
# make install
2.安装mysql
# cd /usr/local/src/tarbag
# wget -c http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.8.tar.gz
# tar zxvf mysql-5.5.8.tar.gz -C ../software/
# cd mysql-5.5.8/
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_DATADIR=/www/mydata \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1
# make
# make install
编译选项说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录
-DINSTALL_DATADIR=/www/mydata //数据库存放目录
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DWITH_SSL=system //使用SSL加密
-DWITH_EMBEDDED_SERVER=1 //编译成embedded mysql library
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DWITH_MYISAM_STORAGE_ENGINE=1 //安装myisam引擎
3.新建用户
# useradd mysql -d /dev/null -s /sbin/nologin
4.配置
# chown -R mysql..mysql /usr/local/mysql
# chown -R mysql.mysql /www/mydata
# cd /usr/local/mysql
# cp ./support-files/my-medium.cnf /etc/my.cnf
# ./scripts/mysql_install_db --user=mysql
# chown -R mysql.mysql /www/mydata
# ./bin/mysqld_safe --user=mysql &
# cp ./support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld restart
若提示/etc/init.d/mysqld: line 256: my_print_defaults: command not found
MySQL server PID file could not be found!
编辑/etc/init.d/mysqld 46,47行basedir和datadir变量。
目录 返回
首页