• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

MySQL编译安装 之 cmake

mysql 搞代码 4年前 (2022-01-09) 11次浏览 已收录 0个评论

mysql版本5.5以上编译安装时需要用到软件cmake,cmake特性是独立于源码编译,编译工作可以在另外一个目录中而非源码目录中进行,

mysql版本5.5以上编译安装时需要用到软件cmake,cmake特性是独立于源码编译,编译工作可以在另外一个目录中而非源码目录中进行,好处是可以保证源码目录不受任何一次编译的影响。
1.下载安装cmake

[root@linuxidc ~]# wget
[root@linuxidc ~]# tar zxvf cmake-2.8.11.2.tar.gz
[root@linuxidc ~]# cd cmake-2.8.11.2
[root@linuxidc ~]# ./bootstrap
[root@linuxidc ~]# make && make install

cmake安装完成
2.安装mysql5.5以上的版本

[root@linuxidc ~]# wget ://cdn.mysql.com/
[root@linuxidc ~]# tar zxvf mysql-5.6.13.tar.gz
[root@linuxidc ~]# cd mysql-5.6.13
[root@linuxidc ~]# cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_UNIX_ADDR=/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

3.mysql安装后的设置
1.修改权限

[root@linuxidc ~]# chown -R root.mysql /opt/mysql/
[root@linuxidc ~]# chown -R mysql.mysql /opt/mysql/data/

2.初始化数据库
[root@linuxidc ~]# /opt/mysql/scripts/mysql_install_db –user=mysql
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run ‘make install’ to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the –basedir option
pointing to that location.
#初始化碰到这个错误是因为没有指定安装目录以及存放数据的目录,

[root@linuxidc ~]# /opt/mysql/scripts/mysql_install_db –user=mysql –basedir=/opt/mysql/ –datadir=/opt/mysql/data/

3.复制配置文件my.cnf

[root@linuxidc ~]# cp /opt/mysql/support-files/my-default.cnf /etc/my.cnf

4.启动
[root@linuxidc ~]# /opt/mysql/bin/mysqld_safe &
[1] 18401
[root@linuxidc ~]# 130909 23:28:07 mysqld_safe Logging to ‘/opt/mysql/data/linuxidc.err’.
130909 23:28:07 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data
[root@linuxidc ~]# ps -ef | grep mysql
root 18401 22774 2 23:28 pts/0 00:00:00 /bin/sh /opt/mysql/bin/m本文来源gaodai$ma#com搞$代*码*网ysqld_safe
mysql 18491 18401 81 23:28 pts/0 00:00:03 /opt/mysql/bin/mysqld –basedir=/opt/mysql –datadir=/opt/mysql/data –plugin-dir=/opt/mysql/lib/plugin –user=mysql –log-error=/opt/mysql/data/linuxidc.err –pid-file=/opt/mysql/data/linuxidc.pid
root 18515 18245 0 23:28 pts/2 00:00:00 grep mysql

cmake编译参数详解:
-DCMAKE_INSTALL_PREFIX=dir_name :用于指定安装目录
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 :常用存储引擎参数设置

-DDEFAULT_CHARSET=charset_name
The server character set. By default, MySQL uses the latin1 (cp1252 West European) character set.
charset_name may be one of binary, armscii8, ascii, big5, cp1250, cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8, eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8, keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce, macroman, sjis, swe7, tis620, ucs2, ujis, utf8, utf8mb4, utf16, utf16le, utf32. The permissible character sets are listed in the cmake/character_sets.cmake file as the value of CHARSETS_AVAILABLE.
-DENABLED_LOCAL_INFILE=bool :bool值表示(1表示允许该功能,0表示没有改功能)

-DMYSQL_UNIX_ADDR=file_name
The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. The default is /tmp/mysql.sock.

相关阅读:

基于Cmake编译安装MySQL 5.5

使用Cmake方式安装mysql-5.5.10

CentOS下 MySQL 5.5.13 Cmake 安装笔记

Linux源码安装MySQL 5.6.12 (Cmake编译)


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:MySQL编译安装 之 cmake

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址