参考:http://blog.csdn.net/mycwq/article/details/24488691

  1. 安装cmake,mysql 5.5以后的版本要通过cmake进行编译

在新装的CentOS 5.7系统中,先安装了nginx(含nginx必备依赖:gzip 模块需要 zlib 库;rewrite 模块需要 pcre 库;ssl 功能需要 openssl 库),结果安装cmake过程中在./bootstrap这一步无法通过,原因未知。后通过VM快照恢复到未安装nginx前,顺利安装cmake。

安装步骤:

  1. 官网下载http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
  2. tar zxvf cmake-2.8.10.2.tar.gz
  3. cd cmake-2.8.10.2
  4. ./bootstrap
  5. make
  6. make install
  7. cmake –h      验证安装结果
  1. 开始安装mysql

官网下载源码安装包:https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.57.tar.gz

安装mysql

  1. [root@local ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
  2. [root@local ~]# tar xvf mysql-5.5.37.tar.gz
  3. [root@local ~]# cd mysql-5.5.37
  4. [root@local mysql-5.5.37]# cmake ./

可能还会报这个错,没有就跳过

  1. CMake Error at cmake/readline.cmake:83(MESSAGE):
  2. Curses library not found.  Pleaseinstall appropriate package,
  3. remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
  4. Call Stack (most recent call first):
  5. cmake/readline.cmake:127 (FIND_CURSES)
  6. cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  7. CMakeLists.txt:355 (MYSQL_CHECK_READLINE
  8. -- Configuring incomplete, errors occurred!
  9. See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log".
  10. See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log".

说明centos系统没有ncurses-devel

  1. [root@local ~]# wget http://invisible-island.net/datafiles/release/ncurses.tar.gz
  2. [root@local ~]# cd ncurses-5.9
  3. [root@local ncurses-5.9]#./configure
  4. [root@local ncurses-5.9]# make
  5. [root@local ncurses-5.9]# make install

再删除刚才编译生成的 CMakeCache.txt 文件,否则无法进行下一步

  1. [root@local mysql-5.5.37]# rm -f CMakeCache.txt

继续编译mysql

  1. [root@local ~]# cmake ./
  2. [root@local ~]# make
  3. [root@local ~]# make install

这样,mysql默认将成功安装到/usr/local/mysql

创建mysql用户组

  1. [root@local ~]# groupadd mysql
  2. [root@local ~]# useradd –r –g mysql mysql
  3. [root@local ~]# chown –R mysql.mysql /usr/local/mysql

启动mysql

  1. [root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

这里可能会发生错误,没有就跳过:

  1. FATAL ERROR: Could not find./bin/my_print_defaults
  2. If you compiled from source, you need torun 'make install' to
  3. copy the software into the correct locationready for operation.
  4. If you are using a binary release, you musteither be at the top
  5. level of the extracted archive, or pass the --basedir option
  6. pointing to that location.

解决方法:

  1. [root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

再启动mysql

  1. [root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

注册mysql服务,开机自动启动

1.设置mysql配置文件到/etc目录

  1. [root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf

2.设置mysql开机自启

  1. [root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
  2. [root@local ~]# chmod +x /etc/init.d/mysql
  3. [root@local ~]# /sbin/chkconfig --add mysql

3.启动mysql服务

  1. [root@local ~]# service mysql start

测试mysql是否安装成功

  1. [root@local ~]# /usr/local/mysql/bin/mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 1
  5. Server version: 5.5.37 Source distribution
  6. Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.
  7. Oracle is a registered trademark of OracleCorporation and/or its
  8. affiliates. Other names may be trademarksof their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
  11. mysql> show databases;
  12. +--------------------+
  13. | Database           |
  14. +--------------------+
  15. | information_schema |
  16. | mysql              |
  17. | performance_schema |
  18. | test               |
  19. +--------------------+
  20. 4 rows in set (0.03 sec)

参考:

http://blog.csdn.net/mycwq/article/details/24488691

最后启动mysql的时候报错,出现The server
quit without updating PID file错误

解决过程:http://blog.sina.com.cn/s/blog_637e04c9010117ri.html

[root@localhost ~]# cd
/usr/local/mysql

[root@localhost mysql]# chown
-R mysql.mysql .
[root@localhost mysql]# su - mysql
[mysql@localhost ~]$ cd
/usr/local/mysql
[mysql@localhost mysql]$ scripts/mysql_install_db
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:

./bin/mysqladmin -u root password
'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

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

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

Please report any problems with the
./bin/mysqlbug script!

[mysql@localhost mysql]$ /usr/local/mysql/bin/mysqld_safe
--user=mysql &
[1] 11767
[mysql@localhost mysql]$ 120502 07:01:17 mysqld_safe Logging to
'/usr/local/mysql/data/localhost.localdomain.err'.
120502 07:01:17 mysqld_safe Starting mysqld daemon with databases from
/usr/local/mysql/data
[mysql@localhost mysql]$ /etc/rc.d/init.d/mysql status
MySQL running
(11830)                                     [  OK  ]
[mysql@localhost mysql]$ /etc/rc.d/init.d/mysql start
Starting
MySQL                                             [  OK  ]

最后这里↗$ /etc/rc.d/init.d/mysql
start可能需要切回root用户才能成功启动

额外配置

如果非本地环境无法登陆mysql,做如下更改

1.Centos中防火墙开放3306端口:

-A INPUT -p tcp
-m tcp --dport 3306 -j ACCEPT

2.Mysql中允许root用户任意IP登陆:

Update user set
host=”%” where user=”root”;

3. mysql取消表名区分大小写

修改 /etc/my.cnf:在[mysqld]节点下,加入一行: lower_case_table_names=1

4.使用mysql-workbench工具导入.sql文件

方法2:

CentOS7安装MySql 5.5.60

http://www.cnblogs.com/Troy-Lv5/p/9273235.html

http://ftp.ntu.edu.tw/MySQL/Downloads

centos下mysql 5源码安装全过程记录的更多相关文章

  1. linux下mysql的源码安装

    mysql有多中安装方法,本文只涉及编译安装,对其他方法感兴趣的可以自行百度. 1.首先获取mysql软件安装包,这里用wget下载 [root@localhost ~]# wget http://d ...

  2. CentOS下二进制包/源码安装方式的MySQL卸载步骤

    查看当前系统mysql 运行状态 [root@zendlinux ~]# ps -ef |grep mysql root 1153 1 0 15:40 ? 00:00:00 /bin/sh /usr/ ...

  3. CentOS下MySQL 5.7编译安装

    CentOS下MySQL 5.7编译安装   文章目录 安装依赖包 下载相应源码包 添加mysql用户 预编译 编译安装 启动脚本,设置开机自启动 /etc/my.cnf,仅供参考 初始化数据库 设置 ...

  4. LinuxMint下的Orionode源码安装

    1. Orionode介绍 Eclipse-orion是Eclipse项目下面的一个子项目,orion是一个在在线版的代码编辑环境.其介绍参考http://wiki.eclipse.org/Orion ...

  5. CentOS 下 MySQL 5.7 编译安装

    MySQL5.7主要特性: 1—更好的性能:对于多核CPU.固态硬盘.锁有着更好的优化,每秒100W QPS已不再是MySQL的追求,下个版本能否上200W QPS才是吾等用户更关心的 2—更好的In ...

  6. 【MySQL】源码安装

    操作系统:Red Hat Enterprise Linux Server release 6.5 Mysql安装包:mysql-5.6.4-m7.tar.zip,下载地址:http://pan.bai ...

  7. LinuxMint下Apache Http源码安装过程

    1. 源码包下载 Apache Http安装要求必须安装APR.APR-Util.PCRE等包. Apache Http包下载地址:http://httpd.apache.org/download.c ...

  8. 转:php 5.5源码安装全过程

    下载 PHP 源码包 # wget http://cn2.php.net/distributions/php-5.5.15.tar.bz2 # tar xf php-5.5.15.tar.bz2 -C ...

  9. 基于centos 创建stress镜像——源码安装stress

    上一篇文章进行了yum安装stress,这次对stress进行源码编译安装,并且生成新的镜像 创建Dockerfile目录 [vagrant@localhost ~]$ mkdir -p /tmp/s ...

随机推荐

  1. redis有序集合性能 列表、集合、有序集合

    https://www.cnblogs.com/pirlo21/p/7120935.html 1.1 列表 列表(list)类型是用来存储多个字符串,元素从左到右组成一个有序的集合.列表中的每个字符串 ...

  2. 关于.htaccess的设置

    RewriteEngine On #设置是否开始rewrite RewriteBase / #设置开始匹配的目录,比如web程序放在/var/www/html/test下,则这个值要设置为" ...

  3. Java基础知识之集合

    Collection集合 特点:长度可变,只能存储引用类型,可以存储不同的类型的元素 list 特点:元素有序(存储和取出的顺序一致),元素可以重复.list除了可以用迭代器循环遍历之外,因为其是有序 ...

  4. 【Loadrunner】Loadrnner 参数化策略

    Loadrnner 参数化策略 参数化策略 关键:类型+数据+策略 1.Select next row ( 如何取) 选择下一行 1)Sequential:顺序的 每个VU都从第一行开始,顺序依次向下 ...

  5. magento 2.3安装测试数据

    前面我们一步步composer安装Magento2.3,但是没有数据的话各项设置不是很熟悉,所以最好还是安装一下测试数据.下面我们就跟ytkah一起填充数据.假设magento 2.3安装目录是/ww ...

  6. 报错解决——make: *** No targets specified and no makefile found. Stop

    wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz tar zxvf ncurses-5.6.tar.gz #切换目录到ncurses ...

  7. [转载]MACD 各周期指标状态

    MACD指标:MACD指标是一个非常好用的指标,它与均线.量价关系配合使用对判断行情很有效.这里有必要再深一点讲MACD级别之间的作用. 一.首先,必须明白的是任何指标中都是大级别包含小级别,小级别对 ...

  8. 并发编程---互斥锁---互斥锁与join的区别

    互斥锁 互斥锁:就是把多个进程并发,修改成一块共享数据的操作变成串行,保证是一个一个来修改的. 缺点:效率低,加锁过程复杂 优点:增加了安全性 from multiprocessing import ...

  9. 007-优化web请求三-异步调用【WebAsyncTask】

    一.什么是同步调用 浏览器发起请求,Web服务器开一个线程处理,处理完把处理结果返回浏览器.好像没什么好说的了,绝大多数Web服务器都如此般处理.现在想想如果处理的过程中需要调用后端的一个业务逻辑服务 ...

  10. vue中computed和watch的用法

    computed用来监控自己定义的变量,该变量不在data里面声明,直接在computed里面定义,然后就可以在页面上进行双向数据绑定展示出结果或者用作其他处理: computed比较适合对多个变量或 ...