mysql-源码包安装

Posted skyzy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql-源码包安装相关的知识,希望对你有一定的参考价值。

源码包安装mysql: 1、下载源码包 www.mysql.com # md5sum mysql-5.6.25.tar.gz 37664399c91021abe070faa700ecd0ed mysql-5.6.25.tar.gz 2、解压并且进入到解压的目录 # tar -xf mysql-5.6.25.tar.gz # cd mysql-5.6.25 创建mysql用户: # groupadd mysql # useradd -r -g mysql -s /bin/false mysql 3、安装三步曲(配置、编译、安装) 需求: 安装目录:/mysql25 数据目录:/mysql25/data 端口:3308 sock:/mysql25/mysql.sock CMAKE_INSTALL_PREFIX=/mysql25 指定安装基目录 DEFAULT_CHARSET= 默认的字符集 DEFAULT_COLLATION= 字符集的排序 ENABLED_LOCAL_INFILE= 是否加载外部文件 默认off 1代表开启;0代表关闭 MYSQL_TCP_PORT 端口号 MYSQL_UNIX_ADDR 指定sock文件位置 SYSCONFDIR 系统配置文件所在路径 MYSQL_DATADIR 数据库的数据目录 WITH_EXTRA_CHARSETS 扩展字符集 WITHOUT_xxx_STORAGE_ENGINE 不将存储引擎编译到mysql的静态库里 WITH_xxx_STORAGE_ENGINE 将存储引擎编译到mysql的静态库里 # vim cmake.sh ---> cmake . -DCMAvimKE_INSTALL_PREFIX=/mysql25 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/mysql25/data -DSYSCONFDIR=/mysql25/ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 支持分区 -DMYSQL_UNIX_ADDR=/mysql25/mysql.socket -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3308 # chmod o+x cmake.sh 【或者# cmake . -DCMAKE_INSTALL_PREFIX=/mysql25 -DENABLED_LOCAL_INFILE=1...】 准备工作: # yum -y install cmake # mkdir /mysql25 # chown -R mysql. /mysql25 错误提示: -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:85 (MESSAGE): Curses library not found. Please install appropriate package, 解决:安装所需要的软件包: # yum -y install ncurses-devel # rm -f CMakeCache.txt # bash cmake.sh # make # make install # scripts/mysql_install_db --user=mysql----初始化数据库 建mysql25的启动脚本文件 # cp support-files/mysql.server /etc/init.d/mysql25 注意: 修改脚本文件中的(vim /etc/init.d/mysql25) basedir=/usr/local/mysql25 datadir=/usr/local/mysql25/data 9、用脚本再次测试验证 # /etc/init.d/mysql25---脚本启动 # service mysql25 restart 初始化: 登录: # export PATH=$PATH:/usr/local/mysql25/bin # /usr/local/mysql25/bin/mysql------进入mysql 字符集和字符编码: 字符:所有符号的总称 字符集: unicode(统一字符集): ASCII: GB2312:中文字符集 GBK:gb2312的扩展字符集 GB18030:gbk的超级字符集,包含中、日、韩三个国家的字符集 字符编码: UTF-8 UTF-16 UCS-2 UCS-4 GBK/GB2312 GB18030 字符编码 每个字符字节数 ASCCii 1 UTF-8(UNICODE) 1-6 UTF-16 2-4 GBK/GB2312 1-2 GB18030 1-4 错误提示: CMake Error at /usr/share/cmake/Modules/CMakeCXXInformation.cmake:17 (GET_FILENAME_COMPONENT): get_filename_component called with incorrect number of arguments Call Stack (most recent call first): CMakeLists.txt:3 (PROJECT) CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Performing Test HAVE_PEERCRED - Failed 解决: yum -y install gcc-* /soft/mysql-5.6.25/sql/sql_planner.cc: In member function ‘void Optimize_table_order::best_access_path(JOIN_TAB*, table_map, uint, bool, double, POSITION*, POSITION*)’: /soft/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_start_key’ may be used uninitialized in this functio Starting MySQL..The server quit without updating PID file (/mysql25/data/zy.uplooking.com.pid).

以上是关于mysql-源码包安装的主要内容,如果未能解决你的问题,请参考以下文章

mysql源码包安装方法

mysql 源码包安装

mysql-源码包安装

mysql 5.5源码包安装

MYSQL5.5源码包编译安装

编译安装mysql, mysql官网下载源码包