安装cmake:
- tar zxvf cmake-2.8.4.tar.gz
- cd cmake-2.8.4
- ./configure --prefix=/usr/local/cmake
- make && make install
安装mysql5.5.13
- groupadd mysql //所以在这里我们要建一个msyql的用户和组
- useradd -g mysql mysql -s /usr/sbin/nologin
- mkdir /usr/local/mysql //创建目录
- mkdir /usr/local/mysql/data
- 安装一些mysql需要的依赖包
yum install –y wget gcc-c++ ncurses-devel cmake make perl
进入mysql-5.5.13的解压目录:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql && make && make install
进入mysql的安装目录/usr/local/mysql下:
- scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql //初始化mysql数据库
- cp support-files/my-medium.cnf /usr/local/mysql/my.cnf //copy配置文件
- chown -R mysql:mysql /usr/local/mysql //更改权限
vi /usr/local/mysql/my.cnf //加上以下内容
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
log-error = /usr/local/mysql/mysql_error.log
pid-file = /usr/local/mysql/mysql.pid
user = mysql
tmpdir= /tmp
启动mysql bin/mysqld_safe --user=mysql & 或使用下列命令把mysql添加为系统服务。
- cd /usr/local/mysql/support-files/
- cp ./mysql.server /etc/init.d/mysqld
- /etc/init.d/mysqld start
最后一步:建立mysql的连接
ln -s /usr/local/mysql/bin/mysql /usr/bin
注:我的Linux版本为centos 所以部分依赖包使用了yum进行安装
时间: 2024-12-27 22:48:41