centos下mysql 5源码安装全过程记录
参考:http://blog.csdn.net/mycwq/article/details/24488691
- 安装cmake,mysql 5.5以后的版本要通过cmake进行编译
在新装的CentOS 5.7系统中,先安装了nginx(含nginx必备依赖:gzip 模块需要 zlib 库;rewrite 模块需要 pcre 库;ssl 功能需要 openssl 库),结果安装cmake过程中在./bootstrap这一步无法通过,原因未知。后通过VM快照恢复到未安装nginx前,顺利安装cmake。
安装步骤:
- 官网下载http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
- tar zxvf cmake-2.8.10.2.tar.gz
- cd cmake-2.8.10.2
- ./bootstrap
- make
- make install
- cmake –h 验证安装结果
- 开始安装mysql
官网下载源码安装包:https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.57.tar.gz
安装mysql
- [root@local ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
- [root@local ~]# tar xvf mysql-5.5.37.tar.gz
- [root@local ~]# cd mysql-5.5.37
- [root@local mysql-5.5.37]# cmake ./
可能还会报这个错,没有就跳过
- CMake Error at cmake/readline.cmake:83(MESSAGE):
- Curses library not found. Pleaseinstall appropriate package,
- remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
- Call Stack (most recent call first):
- cmake/readline.cmake:127 (FIND_CURSES)
- cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
- CMakeLists.txt:355 (MYSQL_CHECK_READLINE
- -- Configuring incomplete, errors occurred!
- See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log".
- See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log".
说明centos系统没有ncurses-devel
- [root@local ~]# wget http://invisible-island.net/datafiles/release/ncurses.tar.gz
- [root@local ~]# cd ncurses-5.9
- [root@local ncurses-5.9]#./configure
- [root@local ncurses-5.9]# make
- [root@local ncurses-5.9]# make install
再删除刚才编译生成的 CMakeCache.txt 文件,否则无法进行下一步
- [root@local mysql-5.5.37]# rm -f CMakeCache.txt
继续编译mysql
- [root@local ~]# cmake ./
- [root@local ~]# make
- [root@local ~]# make install
这样,mysql默认将成功安装到/usr/local/mysql
创建mysql用户组
- [root@local ~]# groupadd mysql
- [root@local ~]# useradd –r –g mysql mysql
- [root@local ~]# chown –R mysql.mysql /usr/local/mysql
启动mysql
- [root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
这里可能会发生错误,没有就跳过:
- FATAL ERROR: Could not find./bin/my_print_defaults
- If you compiled from source, you need torun 'make install' to
- copy the software into the correct locationready for operation.
- If you are using a binary release, you musteither be at the top
- level of the extracted archive, or pass the --basedir option
- pointing to that location.
解决方法:
- [root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
再启动mysql
- [root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
注册mysql服务,开机自动启动
1.设置mysql配置文件到/etc目录
- [root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
2.设置mysql开机自启
- [root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
- [root@local ~]# chmod +x /etc/init.d/mysql
- [root@local ~]# /sbin/chkconfig --add mysql
3.启动mysql服务
- [root@local ~]# service mysql start
测试mysql是否安装成功
- [root@local ~]# /usr/local/mysql/bin/mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.5.37 Source distribution
- Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.
- Oracle is a registered trademark of OracleCorporation and/or its
- affiliates. Other names may be trademarksof their respective
- owners.
- Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 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源码安装全过程记录的更多相关文章
- linux下mysql的源码安装
mysql有多中安装方法,本文只涉及编译安装,对其他方法感兴趣的可以自行百度. 1.首先获取mysql软件安装包,这里用wget下载 [root@localhost ~]# wget http://d ...
- CentOS下二进制包/源码安装方式的MySQL卸载步骤
查看当前系统mysql 运行状态 [root@zendlinux ~]# ps -ef |grep mysql root 1153 1 0 15:40 ? 00:00:00 /bin/sh /usr/ ...
- CentOS下MySQL 5.7编译安装
CentOS下MySQL 5.7编译安装 文章目录 安装依赖包 下载相应源码包 添加mysql用户 预编译 编译安装 启动脚本,设置开机自启动 /etc/my.cnf,仅供参考 初始化数据库 设置 ...
- LinuxMint下的Orionode源码安装
1. Orionode介绍 Eclipse-orion是Eclipse项目下面的一个子项目,orion是一个在在线版的代码编辑环境.其介绍参考http://wiki.eclipse.org/Orion ...
- CentOS 下 MySQL 5.7 编译安装
MySQL5.7主要特性: 1—更好的性能:对于多核CPU.固态硬盘.锁有着更好的优化,每秒100W QPS已不再是MySQL的追求,下个版本能否上200W QPS才是吾等用户更关心的 2—更好的In ...
- 【MySQL】源码安装
操作系统:Red Hat Enterprise Linux Server release 6.5 Mysql安装包:mysql-5.6.4-m7.tar.zip,下载地址:http://pan.bai ...
- LinuxMint下Apache Http源码安装过程
1. 源码包下载 Apache Http安装要求必须安装APR.APR-Util.PCRE等包. Apache Http包下载地址:http://httpd.apache.org/download.c ...
- 转: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 ...
- 基于centos 创建stress镜像——源码安装stress
上一篇文章进行了yum安装stress,这次对stress进行源码编译安装,并且生成新的镜像 创建Dockerfile目录 [vagrant@localhost ~]$ mkdir -p /tmp/s ...
随机推荐
- SRWebSocket
以前有个项目里有做聊天室,就是用的SRWebSocket.现在整理下资料,主要是对网上搜索到的资料进行整合. WebSocket介绍,与Socket的区别 https://blog.csdn.net/ ...
- 【托业】【新托业TOEIC新题型真题】学习笔记7-题库二->P1~4
P1: 1. shopping cart 购物车 stock the shelves 补货 examining the vegetables 挑选蔬菜 4.admire some paintings ...
- composer错误提示Cloning failed using an ssh key for authentication的解决方法
早上ytkah在测试laravel用composer安装一些插件时出现了一些错误,提示如下,是github的ssh密匙认证错误,提示要重新生成token,然后保存在/root/.config/comp ...
- Git/GitHub基本操作
GitGit是分布式版本控制工具,SVN是集中式版本控制,有单点故障的问题GitHub是Git的代码托管中心,类似的国内有码云,是远程维护库Git的优势大部分操作在本地完成,不需要联网完整性有保证尽可 ...
- Hibernate的状态
最新的Hibernate文档中为Hibernate对象定义了四种状态(原来是三种状态,面试的时候基本上问的也是三种状态),分别是:瞬时态(new, or transient).持久态(managed, ...
- Java Script注意事项
1.HTML中,打错标点符号 或输入格式不对(多输等号 或少加括号等) 会导致字体颜色不对劲 2.写Java Script时通常的做法是把函数放入 <head> 部分中,或者放在页面底部. ...
- 云锁-安全,易用,灵活的许可-Virbox许可管理平台
云许可,助力开发者保护软件财富 Virbox 云锁提供高强度加密及软件许可管理功能 安全,易用,灵活 防破解 云许可安全性体验与硬件锁一致,避免盗版导致损失 加密保护技术:反黑引擎/碎片代码执行/虚拟 ...
- Redis入门到高可用(十一)—— 慢查询
一.慢查询日志 慢查询日志帮助开发和运维人员定位系统存在的慢操作.慢查询日志就是系统在命令执行前后计算每条命令的执行时间,当超过预设阀值,就将这条命令的相关信息(慢查询ID,发生时间戳,耗时,命令的详 ...
- 158A
#include <iostream> #include <algorithm> using namespace std; int main() { int groups[10 ...
- IOP知识点(4)
1.选择多个“li”后,如何再次筛选. 2 按钮屏蔽功能 1.选择多个“li”后,如何再次筛选. 2 按钮屏蔽功能 http://gitserver/iop/cloud-iopm-web/issues ...