centos MySQL 5.5 源代码 cmake 安装

mysql 5 种安装方式:
yum
rpm
常规编译
二进制包,不用编译
cmake

mysql 5.5版本以上 机器数量少建议cmake   数量多二进制包

安装步骤:

1.安装一些常用的软件包:

yum -y install openldap-servers libevent-devel libevent uuid-devel
yum -y install bison bison-devel
yum -y install gcc gdb strace gcc-c++ autoconf
yum -y install libxml2 libxml2-devel zlib zlib-devel
yum -y install gcc gcc-c++ openssl openssl-devel ncurses ncurses-devel cmake
yum -y install git

ncurses-devel (这个必须要装,mysql依赖它)

2.mysql 官网下载页面

  MySQL Community Server 5.5.55

  Looking for the latest GA version?
  Select Version:
  5.5.55
  Select Operating System:
  Source code (要选这个才是源代码包)(Linux-Generic 里面选择的.tar.gz 是二进制包)
  Select OS Version:

3.安装cmake
  wget https://github.com/Kitware/CMake/archive/master.zip
  unzip master.zip
  cd CMake-master/
  ./bootstrap 或者 ./configure
  gmake
  gmake install

  

3.安装数据库:
  wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz(这个是二进制包)

  wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.55.tar.gz
  (这个才是源代码包,下载这个)

  tar xf mysql-5.5.55.tar.gz
  echo $?

  cd mysql-5.5.55

  添加mysql 用户
  useradd mysql -s /sbin/nologin -M

编译
cmake \
-DCMAKE_INSTALL_PREFIX=/install/mysql \
-DMYSQL_DATADIR=/install/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

make && make install

配置环境变量:
echo ‘export PATH=/install/mysql/bin:$PATH‘ >> /etc/profile

tail -1 /etc/profile
source /etc/profile
echo $PATH

chown -R mysql.mysql /install/mysql/data/
chmod -R 1777 /tmp/

初始化:
cd /install/mysql/scripts/

./mysql_install_db --basedir=/install/mysql/ --datadir=/install/mysql/data/ --user=mysql

如果安装成功,会提示如下大串信息

  

成功的信息:
        Installing MySQL system tables...
        170407  8:33:03 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
        170407  8:33:03 [Note] /install/mysql//bin/mysqld (mysqld 5.5.55) starting as process 3037 ...
        OK
        Filling help tables...
        170407  8:33:04 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
        170407  8:33:04 [Note] /install/mysql//bin/mysqld (mysqld 5.5.55) starting as process 3044 ...
        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:

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

        Alternatively you can run:
        /install/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 /install/mysql/ ; /install/mysql//bin/mysqld_safe &

        You can test the MySQL daemon with mysql-test-run.pl
        cd /install/mysql//mysql-test ; perl mysql-test-run.pl

        Please report any problems at http://bugs.mysql.com/
        /bin/cp support-files/mysql.server /etc/init.d/mysqld

开机启动
/bin/cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld

chkconfig mysqld on
chkconfig --list

mkdir -p /var/lib/mysql
chown -R mysql.mysql /var/lib/mysql/
chmod -R 1777 /var/lib/mysql/

拷贝对应的mysql配置文件

cp /soft/src/mysql-5.5.55/support-files/my-huge.cnf /etc/my.cnf

启动:/etc/init.d/mysqld start

登录:
mysql

select user,host from mysql.user;

删除多余用户
delete from mysql.user where user=‘‘;
delete from mysql.user where host=‘localhost.localdomain‘;
delete from mysql.user where host=‘::1‘;

设置密码:
/install/mysql/bin/mysqladmin -u root password ‘new-password‘

时间: 2024-10-13 11:58:50

centos MySQL 5.5 源代码 cmake 安装的相关文章

CentOS 6.0最小化编译安装Nginx+MySQL+PHP+Zend

http://www.osyunwei.com/archives/235.html 引言: 操作系统:CentOS 6.0 32位         下载地址:http://mirrors.163.com/centos/6.0/isos/i386/CentOS-6.0-i386-bin-DVD.iso         安装方式:采用最小化安装,在安装系统的时候选择Minimal(CentOS 6.0默认就是Minimal安装模式,不含有任何可选安装包)         最小化安装完成之后,系统占用

centos 6.5 32位 编译安装Mysql

groupadd mysql #添加mysql组 useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统 mkdir -p /data/mysql #创建MySQL数据库存放目 chown -R mysql:mysql /data/mysql #设置MySQL数据库目录权限 mkdir -p /usr/local/mysql #创建MySQL安装目录 cd /opt tar zxvf mysql-5.5

mysql分析(一)源代码安装及简单调试

一.源代码安装安装方式有两种,一种是二进制文件的安装,另一种是源代码级别安装.不同的二进制安装只是将同一份源代码在不同的机器上编译并且按照指定的运行格式进行尽量简单的配置,所以二进制安装的发行包命名中包含有操作系统的信息,源代码发行版本中中只有版本信息,不包含OS信息.在下载的5.5.28版本自带的INSTALL-SOURCE文件中的一些摘录内容       Standard distributions are available as compressed tar files,       Z

Linux下基于源代码方式安装MySQL 5.6

版权声明:本文为博主原创文章,欢迎扩散,扩散请务必注明出处. https://blog.csdn.net/robinson_0612/article/details/26485851 ??? MySQL为开源数据库,因此能够基于源代码实现安装. 基于源代码安装有很多其它的灵活性.也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译參数,选择自身须要选择不同的安装组件,设定须要的字符集等等一些能够依据特定应用场景所作的各种调整.本文描写叙

Linux命令:Mysql系列之二cmake编译安装使用mysqladmin管理工具

MySQL相关概念:MySQL是单进程多线程接收应用的请求. SQL/MySQL 1.事务,隔离,并发控制,锁 2.用户和权限 3.监控 STATUS 4.索引类型:查询 VARIABLES 5.备份和恢复 6.复制功能 7.集群 DML:数据操作语言 INSERT:插入 DELETE:删除 SELECT:挑选,选择,查询 UPDATE:更新,修改 DDL:数据定义语言 CREATE:创建 DROP:删除 ALTER:修改 DCL:数据控制语言 GRANT:授权 REVOKE:取消权限 MySQ

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境一. 系统环境:Linux系统版本: CentOS release 6.5Apache版本: httpd-2.2.24PHP 版本: php-5.6.11 二.安装前准备: 1.查看是否安装GCC ,GCC-C++编译器,如果没有则进行安装: 查看是否安装的命令: #gcc –v 若未安装在服务器联网情况下可以使用下列命令安装: #yum install gcc #yum install gcc-c++2.

cmake安装mysql

安装mysql5.5.32: 1)安装mysql需要的依赖包 [[email protected] ~]# yum install ncurses-devellibaio-devel –y [[email protected] ~]# rpm -qa ncurses-devel libaio-devel libaio-devel-0.3.107-10.el6.x86_64 ncurses-devel-5.7-4.20090207.el6.x86_64 2)安装mysql需要的软件 cmake软件

(总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL

(总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL PS:这个是懒人yum快速安装法,用于开发和测试环境很方便,用于没有特殊要求的生产环境也可以.特殊要求的还是自己去编译安装吧~~ 1.安装Apahce.PHP.MySQL和PHP连接MySQL数据库的包:# yum -y install httpd php mysql mysql-server php-mysql 2.安装Apache常用扩展包:# yum -y install httpd-m

MySQL在linux上(cmake)的source code安装方法

1.安装前准备: 1)必备的包和工具  gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.  cmake  :MySQL 5.5开始,使用cmake进行工程管理,cmake需要2.8以上版本.  bison  :MySQL语法解析器需要使用bison进行编译.  ncurses-devel :用于终端操作的开发包.  zlib    :MySQL使用zlib进行压缩 2)功能需要的包  libxml  :用于XML输入输出方式的支持.  openssl  :使用openssl安全