cmake mysql5.5_使用cmake编译安装MySQL 5.5

首先将cmake-2.8.8.tar.gz、mysql-5.5.32.tar.gz源码包上传至服务器。

解压并安装cmake[[email protected] ~]# tar -zxvf cmake-2.8.8.tar.gz

[[email protected] ~]# cd cmake-2.8.8

[[email protected] cmake-2.8.8]# ./configure

......

-- Configuring done

-- Generating done

-- Build files have been written to: /root/cmake-2.8.8

---------------------------------------------

CMake has bootstrapped.  Now run gmake.

确保cmake没有错误发生[[email protected] cmake-2.8.8]# echo $?

0

下面运行gmake命令[[email protected] cmake-2.8.8]# gmake

[[email protected] cmake-2.8.8]# gmake install

3. 安装MySQL依赖表ncurses-devel[[email protected] cmake-2.8.8]# yum install ncurses-devel -y

4. 创建mysql用户[[email protected] cmake-2.8.8]# groupadd mysql

[[email protected] cmake-2.8.8]# useradd mysql -s /sbin/nologin -M -g mysql

5. 解压编译MySQL[[email protected] ~]# cd ..

[[email protected] ~]# tar -zxvf mysql-5.5.32.tar.gz

[[email protected] ~]# cd mysql-5.5.32

[[email protected] mysql-5.5.32]#  cmake -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32   -DMYSQL_DATADIR=/application/mysql-5.5.32/data   -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock   -DDEFAULT_CHARSET=utf8   -DDEFAULT_COLLATION=utf8_general_ci   -DWITH_EXTRA_CHARSETS=all   -DWITH_INNOBASE_STORAGE_ENGINE=1   -DWITH_ARCHIVE_STORAGE_ENGINE=1   -DWITH_BLACKHOLE_STORAGE_ENGINE=1   -DWITH_PERFSCHEMA_STORAGE_ENGINE=1   -DWITH_SSL=yes    -DENABLED_LOCAL_INFILE=1[[email protected] mysql-5.5.32]# make && make install

为安装目录做一个link[[email protected] mysql-5.5.32]# ln -s /application/mysql-5.5.32/ /application/mysql

将源代码目录中的配置文件copy到/etc目录下[[email protected] mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

6. 配置环境变量[[email protected] mysql-5.5.32]# echo ‘export PATH=/application/mysql/bin:$PATH‘ >> /etc/profile

7. 授权mysql用户访问安装目录[[email protected] mysql]# chown mysql.mysql -R /application/mysql

8. 初始化mysql数据库[[email protected] scripts]# ./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql

Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/application/mysql/bin/mysqladmin -u root password ‘new-password‘

/application/mysql/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘

Alternatively you can run:

/application/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /application/mysql ; /application/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd /application/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /application/mysql/scripts/mysqlbug script!

9. 制作mysql启动脚本[[email protected] mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

10 启动mysql[[email protected] mysql-5.5.32]# /etc/init.d/mysqld start

Starting MySQL..                                           [  OK  ]

原文:http://lqding.blog.51cto.com/9123978/1726005

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值