这几天在centos下装mysql,这里记录一下安装的过程,方便以后查阅

Mysql5.5.37安装须要cmake,5.6版本号開始都须要cmake来编译,5.5以后的版本号应该也要装这个。

安装cmake

[root@local ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[root@local ~]# tar xvf cmake-2.8.12.2.tar.gz
[root@local ~]# cd cmake-2.8.12.2
[root@local cmake-2.8.12.2]#./bootstrap
[root@local cmake-2.8.12.2]# make
[root@local cmake-2.8.12.2]# make install

安装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

最新文章

  1. 随笔jade
  2. Spring in Action 学习笔记二-DI
  3. solr 查询 实例分析
  4. 我的第一个jsp程序-实现注册登录留言功能
  5. Android拍照保存图片内存大小
  6. syntaxhighlighter语法高亮
  7. XCODE7新变化之-test
  8. 小言HTTP Authentication
  9. Ipad弹出UIAlertControllerStyleActionSheet时发生崩溃
  10. 引号在jsp页面中正确显示的处理
  11. 免费报名 | 腾讯云自研数据库CynosDB交流会
  12. python基础6--面向对象基础、装饰器
  13. 解决maven在build时下载文件卡死问题
  14. Maven 安装和配置
  15. Matplotlib学习---用matplotlib画阶梯图(step plot)
  16. 关于json_encode转数组为json对象时里有数组格式数据的问题
  17. -第1章 HTMLCSS方法实现下拉菜单
  18. 【nginx笔记】系统参数设置-使Nginx支持更多并发请求的TCP网络参数
  19. php字符串替换的几个函数
  20. 七、vue语法补充二(动态组件 & 异步组件、访问元素 & 组件、混入)

热门文章

  1. .Net之一般处理程序
  2. Unity Editor下对资源进行操作时调用AssetModificationProcessor
  3. HDU1171-Big Event in HDU
  4. jQuery validate入门
  5. 解决用户 'IIS APPPOOL\Classic .NET AppPool' 登录失败
  6. 部署vc2008开发的程序(vcredist_x86是其中一个办法)
  7. Android studio如何使用SVN进行版本控制?
  8. 使用 RMI + ZooKeeper 实现远程调用框架
  9. 使用libcurl POST数据和上传文件
  10. openScales源码学习系列之 Feature属性