热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在Linux系统上编译安装MySQL5.5源码详细指南

本文详细介绍了在Linux系统上编译安装MySQL5.5源码的步骤。首先,通过Yum安装必要的依赖软件包,如GCC、GCC-C++等,确保编译环境的完备。接着,下载并解压MySQL5.5的源码包,配置编译选项,进行编译和安装。最后,完成安装后,进行基本的配置和启动测试,确保MySQL服务正常运行。
mysql-5.5 for linux源代码安装

1.使用Yum安装依赖软件包

# yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison zlib* fiex* \

libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

 

2.安装cmake

# yum install -y cmake

 

3.解压缩并编译安装MySQL源代码包

 

# tar xzvf mysql-5.5.27.tar.gz

# mv mysql-5.5.27 mysql

# cd mysql

 

#配置编译(參考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DSYSCOnFDIR=/usrl/local/mysql/etc \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DMYSQL_TCP_PORT=3306 \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DMYSQL_USER=mysql \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS=all \

-DWITH_READLINE=1 \

-DWITH_SSL=system \

-DWITH_EMBEDDED_SERVER=1 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1

 

# make 

# make install

 

注意事项:

又一次编译时,须要清除旧的对象文件和缓存信息。

# make clean

# rm -f CMakeCache.txt

 

4.加入mysql用户及用户组并改动文件夹全部权限

[root@ttt mysql]# groupadd mysql

[root@ttt mysql]# useradd -r -g mysql mysql

[root@ttt mysql]# chown -R mysql /usr/local/mysql

[root@ttt mysql]# chgrp -R mysql /usr/local/mysql

 

 

5.安装基础数据库并复制演示样例配置文件

# cd /usr/local/mysql

# chmod +x scripts/*

[root@ttt mysql]#  ./scripts/mysql_install_db --basedir=/usr/local/mysql \

--datadir=/usr/local/mysql/data --user=mysql

 

# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

 

[root@ttt ~]# export PATH=$PATH:/usr/local/mysql/bin    //全局宣告mysql命令的路径

[root@ttt ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile   //写入开机启动文件

 

6.注冊mysql系统服务并启动mysql

 

[root@ttt mysql]# chmod 755 support-files/mysql.server

[root@ttt mysql]# ls -l support-files/mysql.server

-rwxr-xr-x 1 mysql mysql 10650 6月  22 19:21 support-files/mysql.server

[root@ttt mysql]# cp support-files/mysql.server /etc/init.d/mysql

[root@ttt mysql]# chown root.root /etc/init.d/mysql

[root@ttt mysql]# chkconfig --add mysql

[root@ttt mysql]# chkconfig --level 35 mysql on

[root@ttt mysql]# chkconfig --list mysql

mysql           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@ttt mysql]# service mysql start

Starting MySQL...                                          [确定]

[root@ttt mysql]# netstat -ltu |grep mysql

tcp        0      0 *:mysql               *:*                   LISTEN

[root@ttt mysql]# ps -ef | grep mysql

root     15492     1  0 21:00 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe 

--datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ttt.pid

mysql    15744 15492  0 21:00 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --

basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-

dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/ttt.err 

--pid-file=/usr/local/mysql/data/ttt.pid --socket=/tmp/mysql.sock --port=3306

root     15896  1098  0 21:10 pts/0    00:00:00 grep mysql

 

7.安装完毕。启动mysql数据库。进入測试

 

[root@ttt ~]# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.27-log Source distribution

 

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> use mysql

Database changed

mysql> show tables;

+---------------------------+

| Tables_in_mysql           |

+---------------------------+

| columns_priv              |

| db                        |

| event                     |

| func                      |

| general_log               |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| host                      |

| ndb_binlog_index          |

| plugin                    |

| proc                      |

| procs_priv                |

| proxies_priv              |

| servers                   |

| slow_log                  |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

+---------------------------+

24 rows in set (0.00 sec)

 

mysql>

 

8.改动mysql数据库root用户密码并登录验证

 

[root@ttt ~]# mysqladmin -u root password 'mysqlpass'  --给“root”用户设置一个密码

[root@ttt ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.5.27-log Source distribution

 

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> 

 

 

 

 


推荐阅读
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • golang常用库:配置文件解析库/管理工具viper使用
    golang常用库:配置文件解析库管理工具-viper使用-一、viper简介viper配置管理解析库,是由大神SteveFrancia开发,他在google领导着golang的 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • CentOS7源码编译安装MySQL5.6
    2019独角兽企业重金招聘Python工程师标准一、先在cmake官网下个最新的cmake源码包cmake官网:https:www.cmake.org如此时最新 ... [详细]
  • 本文深入探讨了如何通过调整InnoDB的关键配置参数来优化MySQL的随机IO性能,涵盖了缓存、日志文件、预读机制等多个方面,帮助读者全面提升数据库系统的性能。 ... [详细]
  • 在当前众多持久层框架中,MyBatis(前身为iBatis)凭借其轻量级、易用性和对SQL的直接支持,成为许多开发者的首选。本文将详细探讨MyBatis的核心概念、设计理念及其优势。 ... [详细]
  • UNP 第9章:主机名与地址转换
    本章探讨了用于在主机名和数值地址之间进行转换的函数,如gethostbyname和gethostbyaddr。此外,还介绍了getservbyname和getservbyport函数,用于在服务器名和端口号之间进行转换。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • PyCharm下载与安装指南
    本文详细介绍如何从官方渠道下载并安装PyCharm集成开发环境(IDE),涵盖Windows、macOS和Linux系统,同时提供详细的安装步骤及配置建议。 ... [详细]
  • 本文详细介绍了如何在BackTrack 5中配置和启动SSH服务,确保其正常运行,并通过Windows系统成功连接。涵盖了必要的密钥生成步骤及常见问题解决方法。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文介绍了Java并发库中的阻塞队列(BlockingQueue)及其典型应用场景。通过具体实例,展示了如何利用LinkedBlockingQueue实现线程间高效、安全的数据传递,并结合线程池和原子类优化性能。 ... [详细]
  • 本文介绍了如何使用JQuery实现省市二级联动和表单验证。首先,通过change事件监听用户选择的省份,并动态加载对应的城市列表。其次,详细讲解了使用Validation插件进行表单验证的方法,包括内置规则、自定义规则及实时验证功能。 ... [详细]
  • 使用 Azure Service Principal 和 Microsoft Graph API 获取 AAD 用户列表
    本文介绍了一段通用代码示例,该代码不仅能够操作 Azure Active Directory (AAD),还可以通过 Azure Service Principal 的授权访问和管理 Azure 订阅资源。Azure 的架构可以分为两个层级:AAD 和 Subscription。 ... [详细]
author-avatar
中科蓝天李跃华
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有