`
chinese.darren
  • 浏览: 99550 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

从源代码构建MYSQL

阅读更多
注:cmake需要手动安装,一般操作系统中不自带。

The sequence for installation from a compressed tar file or Zip
   archive source distribution is similar to the process for
   installing from a generic binary distribution (see Section 2.2,
   "Installing MySQL from Generic Binaries on Unix/Linux"), except
   that it is used on all platforms and includes steps to configure
   and compile the distribution. For example, with a compressed tar
   file source distribution on Unix, the basic installation command
   sequence looks like this:
# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

   A more detailed version of the source-build specific instructions
   is shown following.
   Note

   The procedure shown here does not set up any passwords for MySQL
   accounts. After following the procedure, proceed to Section 2.10,
   "Postinstallation Setup and Testing," for postinstallation setup
   and testing.

Perform Preconfiguration Setup

   On Unix, set up the mysql user and group that will be used to run
   and execute the MySQL server and own the database directory. For
   details, see Creating a mysql System User and Group, in Section
   2.2, "Installing MySQL from Generic Binaries on Unix/Linux." Then
   perform the following steps as the mysql user, except as noted.

Obtain and Unpack the Distribution

   Pick the directory under which you want to unpack the distribution
   and change location into it.

   Obtain a distribution file using the instructions in Section
   2.1.3, "How to Get MySQL."

   Unpack the distribution into the current directory:

     * To unpack a compressed tar file, tar can uncompress and unpack
       the distribution if it has z option support:
shell> tar zxvf mysql-VERSION.tar.gz
       If your tar does not have z option support, use gunzip to
       unpack the distribution and tar to unpack it:
shell> gunzip < mysql-VERSION.tar.gz | tar xvf -
       Alternatively, CMake can uncompress and unpack the
       distribution:
shell> cmake -E tar zxvf mysql-VERSION.tar.gz

     * To unpack a Zip archive, use WinZip or another tool that can
       read .zip files.

   Unpacking the distribution file creates a directory named
   mysql-VERSION.

Configure the Distribution

   Change location into the top-level directory of the unpacked
   distribution:
shell> cd mysql-VERSION

   Configure the source directory. The minimum configuration command
   includes no options to override configuration defaults:
shell> cmake .

   On Windows, specify the development environment. For example, the
   following commands configure MySQL for 32-bit or 64-bit builds,
   respectively:
shell> cmake . -G "Visual Studio 9 2008"
shell> cmake . -G "Visual Studio 9 2008 Win64"

   On Mac OS X, to use the Xcode IDE:
shell> cmake . -G Xcode

   When you run cmake, you might want to add options to the command
   line. Here are some examples:

     * -DBUILD_CONFIG=mysql_release: Configure the source with the
       same build options used by Oracle to produce binary
       distributions for official MySQL releases.

     * -DCMAKE_INSTALL_PREFIX=dir_name: Configure the distribution
       for installation under a particular location.

     * -DCPACK_MONOLITHIC_INSTALL=1: Cause make package to generate a
       single installation file rather than multiple files.

     * -DWITH_DEBUG=1: Build the distribution with debugging support.

   For a more extensive list of options, see Section 2.9.4, "MySQL
   Source-Configuration Options."

   To list the configuration options, use one of the following
   commands:
shell> cmake . -L   # overview
shell> cmake . -LH  # overview with help text
shell> cmake . -LAH # all params with help text
shell> ccmake .     # interactive display

   If CMake fails, you might need to reconfigure by running it again
   with different options. If you do reconfigure, take note of the
   following:

     * If CMake is run after it has previously been run, it may use
       information that was gathered during its previous invocation.
       This information is stored in CMakeCache.txt. When CMake
       starts up, it looks for that file and reads its contents if it
       exists, on the assumption that the information is still
       correct. That assumption is invalid when you reconfigure.

     * Each time you run CMake, you must run make again to recompile.
       However, you may want to remove old object files from previous
       builds first because they were compiled using different
       configuration options.

   To prevent old object files or configuration information from
   being used, run these commands on Unix before re-running CMake:
shell> make clean
shell> rm CMakeCache.txt

   Or, on Windows:
shell> devenv MySQL.sln /clean
shell> del CMakeCache.txt

   If you build out of the source tree (as described later), the
   CMakeCache.txt file and all built files are in the build
   directory, so you can remove that directory to object files and
   cached configuration information.

   If you are going to send mail to a MySQL mailing list to ask for
   configuration assistance, first check the files in the CMakeFiles
   directory for useful information about the failure. To file a bug
   report, please use the instructions in Section 1.7, "How to Report
   Bugs or Problems."



下面是一些常用选择:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
我的opensuse是/etc/init.d/这个目录。

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 linux-bfss 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!
分享到:
评论

相关推荐

    jsp网上书店源代码 mysql

    【标题】"jsp网上书店源代码 mysql"涉及的是基于JavaServer Pages(JSP)技术和MySQL数据库构建的在线书店系统。这个项目是为学生提供的一种学习资源,可以用作期末作业的实践项目。 【JSP技术】:JSP是Java平台上...

    mysql5.7源代码

    MySQL 5.7源代码是开源数据库管理系统MySQL的一个版本,主要用C++语言编写,它提供了数据库存储、查询处理、事务管理等核心功能。通过分析和研究MySQL的源代码,我们可以深入了解数据库系统的内部机制,这对于数据库...

    mysql-5.1.63源代码

    1. **编译与构建**:MySQL 5.1.63的源代码包含了构建系统,开发者可以通过阅读`INSTALL`或`README`文件来了解如何配置和编译源代码。通常需要安装一些依赖库,如GCC编译器、OpenSSL、Zlib等,然后运行配置脚本并进行...

    mysql for pyton 源代码

    MySQL for Python源代码是Python开发者用来与MySQL数据库进行交互的重要工具。这个2.0.0版本的源代码提供了丰富的功能,使Python程序员能够方便地在应用程序中集成数据库操作。通过理解并研究这些源代码,我们可以...

    mysql-connector-java-5.1.12.rar 源代码

    这个源代码版本包含了用于与 MySQL 服务器通信的全套 Java 类和接口,使得开发者能够在 Java 平台上构建数据库应用程序。下面我们将深入探讨 MySQL Connector/J 的重要知识点、功能以及其在开发中的应用。 一、...

    mysql源代码,深入学习mysql必须分析其源代码

    源代码分析能够帮助我们理解MySQL内部的工作机制,包括查询处理、存储引擎、事务处理、并发控制、索引构建等核心功能。 MySQL源代码的结构复杂且庞大,包含了各种组件和模块。`ChangeSet`可能是版本控制文件,记录...

    mysql-5.5.24源代码

    CMake是一种跨平台的构建系统,允许开发者在不同的操作系统上构建MySQL。 5. **API和接口**:MySQL提供了丰富的API供应用程序使用,如C API、PHP、Java、Python等语言的驱动。5.5.24可能改进了这些接口,提高了性能...

    mysql-5.5.53.tar.gz

    MySQL是世界上最受欢迎的关系型数据库管理系统(RDBMS)之一,由Oracle公司开发并维护...不过,对于开发者和系统管理员来说,理解如何从源代码构建MySQL仍然是一个重要的技能,因为这有助于自定义配置和解决特定问题。

    php mysql 源代码

    在IT行业中,PHP和MySQL是两个非常重要的技术,它们在构建动态网站和应用程序方面发挥着核心作用。PHP是一种广泛使用的...通过研究这些源代码,我们可以提升编程技能,学习最佳实践,并为自己的项目构建坚实的基础。

    Javaweb+mysql图书管理系统 项目源代码+数据库

    《Javaweb+MySQL图书管理系统详解》 在IT行业中,构建一个图书管理系统是一项常见的实践任务,它能够帮助图书馆或书店高效地管理书籍资源、读者信息以及借阅情况。本项目“Javaweb+MySQL图书管理系统”是这样一个...

    C++ 连接mysql源代码

    本项目提供的“C++连接mysql源代码”应该包含了一个简单的示例,演示如何在Visual Studio环境下配置和使用这个库来实现数据库连接。 首先,我们需要了解MySQL Connector/C++的基本用法。它主要通过`#include &lt;mysql...

    《PHP和MySQL Web开发》(原书第4版)—源代码

    通过分析和实践这些源代码,读者不仅可以深入理解PHP和MySQL的交互,还能学习到良好的编程习惯、项目组织结构和Web开发的最佳实践。这些经验对于任何想要在Web开发领域取得进步的人来说都是宝贵的财富。

    PHP+MySQL经典案例剖析_源代码

    5. **错误处理和调试**:源代码中可能包含如何处理MySQL错误和PHP异常的示例,这对于构建健壮的Web应用至关重要。 6. **数据缓存**:为了提高性能,可能会有使用PHP和MySQL实现的缓存机制,如memcached或redis。 7...

    mysql 数据库程序源代码

    MySQL数据库程序源代码是用于构建和管理MySQL数据库的应用程序源码,主要针对的是C#编程语言。MySQL是一种广泛使用的开源关系型数据库管理系统(RDBMS),以其高效、稳定和易于扩展的特点,在各种规模的项目中都有...

    mysql源代码

    在学习MySQL源代码时,建议从以下几个步骤入手: 1. **阅读文档**:官方文档提供了很好的源码阅读指南,理解整体架构和模块划分。 2. **编译源码**:通过编译过程了解依赖项,理解构建流程。 3. **调试与测试**:...

    PHP and MYSQL Web Development.5th.Edition 源代码完整版

    该书源代码的完整版提供了丰富的实例,帮助读者深入理解这两种技术的结合使用。 PHP是一种广泛应用于服务器端的脚本语言,尤其在构建动态网站方面表现出色。其语法简洁,易于学习,支持多种数据库,尤其是与MySQL的...

    PHP6与MySQL5基础教程第三版源代码(09.11.25更新)

    在本书的源代码包phpmyql3_scripts中,我们可以期待找到一系列的PHP脚本和MySQL查询,涵盖了从连接数据库、执行SQL语句、处理查询结果到创建动态网页的各种场景。通过分析和运行这些代码,读者可以学习如何使用PHP与...

    五子棋java源代码mysql

    【五子棋java源代码mysql】是一个项目,它包含了用Java编程语言编写的五子棋游戏的源代码,同时集成了MySQL数据库系统。这个项目旨在为开发者提供一个学习和研究五子棋游戏逻辑以及网络对战功能实现的平台。下面我们...

    PHP和MySQL+Web开发(原书第4版)—完整源代码

    "完整源代码"意味着读者可以下载配套的源码,这些代码实例是书中的示例和练习,有助于加深理解和实践。通过这些源码,读者可以直观地看到各种功能和技巧的实现,从而提升自己的编程技能。 此外,这本书还可能涵盖了...

    BBS论坛项目全部源代码-MYSQL数据库

    "BBS论坛项目全部源代码-MYSQL数据库" 这个标题指出这是一个基于BBS(Bulletin Board System)论坛的项目,包含了完整的源代码,并且使用了MySQL数据库作为后端存储。这意味着项目可能涉及用户注册、登录、发帖、...

Global site tag (gtag.js) - Google Analytics