时间:2021-07-01 10:21:17 帮助过:36人阅读
1、系统版本
Centos6.7 64位
2、Mysql版本
mysql-5.6.28
3、需上传的源码包(建议所有的源码包都上传到/usr/local/src,这样不会乱)
4、http://cdn.mysql.com//archives/mysql-5.6/mysql-5.6.28.tar.gz
mysql-5.6.28.tar.gz
https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
cmake-3.6.1.tar.gz
1、安装cmake软件
1)、进入上传包目录解压cmake
tar zxvf cmake-3.6.1.tar.gz
2)、进入解压文件,并进行配置、编译、安装。
cd cmake-3.6.1
./configure–prefix=/usr/local/cmake //指定文件安装目录
make
make install
3)、创建链接文件
ln –s /usr/local/cmake/bin/cmake /usr/bin/cmake
2、安装mysql5.6
1)、进入上传包目录解压mysql5.6,并创建目录
Mkdir –p /usr/local/mysql
Mkdir –p /data/mysql/
tar zxvf mysql-5.6.28.tar.gz
2)、进入解压文件,并进行配置、编译、安装。
cd mysql-5.6.28 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DMYSQL_USER=mysql make && make install
参数说明:
3 更改并启动数据库
1)修改mysql的属组
chown –R mysql:mysql /data/mysql/ chown -R mysql:mysql/usr/local/mysql/
2)、初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql \ --basedir=/usr/local/mysql/ --datadir=/data/mysql
3)、复制配置文件,并启动mysql
cp support-files/my-default.cnf/etc/my.cnf cp /etc/init.d/mysqld/root/mysqld_5.1_bak cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysql /etc/init.d/mysqld start
4 登录数据库
/usr/local/mysql/bin/mysql
5 总结遇到的错误:
1) 编译mysql遇到的错误:
--Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Errorat cmake/readlineNaNake:64(MESSAGE): Curses library notfound. Please install appropriate package,remove CMakeCache.txt andrerun cmake.On Debian/Ubuntu, packagename is libncurses5-dev, on Redhat andderivates it is ncurses-devel. Call Stack (most recent call first): cmake/readlineNaNake:107(FIND_CURSES) cmake/readlineNaNake:181(MYSQL_USE_BUNDLED_EDITLINE) CMakeLists.txt:480(MYSQL_CHECK_EDITLINE) -- Configuring incomplete, errors occurred! See also "/mydata/mysql-5.7.6-m16/CMakeFiles/CMakeOutput.log".See also "/mydata/mysql-5.7.6-m16/CMakeFiles/CMakeError.log".
解决办法:yum -y install ncurses-devel
2) 登录mysql的时候遇到的错误:
/usr/local/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.6.24 Source distribution Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Segmentation fault
mysql版本是5.6.24
服务器是CentOS6.0
解决方法 :
在源码包里,编辑文件 cmd-line-utils/libedit/terminal.c
把terminal_set方法中的 char buf[TC_BUFSIZE]; 这一行注释,再把 area = buf;改为 area = NULL;
更改后如下:
protected int terminal_set(EditLine *el, const char *term) { int i; /*char buf[TC_BUFSIZE];*/ ##注释掉 char *area; const struct termcapstr *t; sigset_t oset, nset; int lins, cols; --phpfensi.com (void) sigemptyset(&nset); (void) sigaddset(&nset, SIGWINCH); (void) sigprocmask(SIG_BLOCK, &nset, &oset); area = NULL;
然后重新编译mysql即可
本文出自 “渐行渐远” 博客,请务必保留此出处http://825536458.blog.51cto.com/4417836/1831666
mysql编译安装
标签:mysql 编译安装