`
爱像天空
  • 浏览: 205952 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

mysql-5.0.67编译安装

阅读更多
mysql-5.0.67编译安装

从http://www.sfr-fresh.com/unix/misc/mysql-5.0.67.tar.gz/下载源代码包;
将mysql-5.0.67.tar.gz放到指定的目录下,解压tar zxvf mysql-5.0.67.tar.gz;

shell> groupadd mysql 创建mysql用户组


shell> useradd -g mysql mysql创建mysql用户


进入mysql-5.0.67,
./configure --prefix=/usr/local/mysql  --with-innodb ,支持innodb引擎

然后make , make install



cp support-files/my-medium.cnf /etc/my.cnf

编辑/etc/my.cnf文件

cd /usr/local/mysql,


chown -R mysql .
chgrp -R mysql .


bin/mysql_install_db --user=mysql --force

如果在执行这一步时出错,很可能是对某些文件没有读写权限。


chown -R root .
chown -R mysql var


成功后运行mysql:

bin/mysqld_safe --user=mysql &


# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'

解决方法:
先停掉mysql服务;
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql  //用root登录mysql,并且使用mysql数据库
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
重新启动mysql
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
以上这个方法针对的是mysql数据库中存在user表记录的情况来修改root的密码,如果连user表都是空的,则不适合用此方法。但是,如果user数据表是空的,则可以插入一个用户记录。

我采用的方法如下:

使用mysqldump从其他机器导出user表的记录,然后用mysqlimport导入到本地数据库中:

mysqldump -uroot mysql user -T /data/user/

然后从/data/user目录中将user.txt拷贝到本地的/data/user目录,执行:

mysqlimport -uroot mysql /data/user/user.txt

然后就可以直接使用./mysql登录了。

说明文档:



The Database Usage dialog allows you to indicate the storage engines that you expect to use when creating MySQL tables. The option you choose determines whether the InnoDB storage engine is available  and  what  percentage of the server resources are available to InnoDB.

   MySQL Server Configuration Wizard: Usage Dialog

     * Multifunctional Database: This option enables both the InnoDB

       and  MyISAM storage engines and divides resources evenly

       between the two. This option is recommended for users who use

       both storage engines on a regular basis.

     * Transactional Database Only: This option enables both the

       InnoDB and MyISAM storage engines, but dedicates most server

       resources  to  the InnoDB storage engine. This option is

       recommended for users who use InnoDB almost exclusively and

       make only minimal use of MyISAM.

     * Non-Transactional Database Only: This option disables the

       InnoDB storage engine completely and dedicates all server

       resources  to  the MyISAM storage engine. This option is

       recommended for users who do not use InnoDB.

The Configuration Wizard uses a template to generate the server configuration file. The Database Usage dialog sets one of the following option strings:

Multifunctional Database:        MIXED

Transactional Database Only:     INNODB

Non-Transactional Database Only: MYISAM

When these options are processed through the default template (my-template.ini) the result is:

Multifunctional Database:

default-storage-engine=InnoDB

_myisam_pct=50

Transactional Database Only:

default-storage-engine=InnoDB

_myisam_pct=5

Non-Transactional Database Only:

default-storage-engine=MyISAM

_myisam_pct=100

skip-innodb

The _myisam_pct value is used to calculate the percentage of resources  dedicated  to MyISAM. The remaining resources are allocated to InnoDB.

The Character Set Dialog

   The  MySQL server supports multiple character sets and it is possible to set a default server character set that is applied to all tables, columns, and databases unless overridden. Use the    Character Set dialog to change the default character set of the MySQL server.

   MySQL Server Configuration Wizard: Character Set

     * Standard Character Set: Choose this option if you want to use

       latin1 as the default server character set. latin1 is used for

       English and many Western European languages.

     * Best Support For Multilingualism: Choose this option if you

       want to use utf8 as the default server character set. This is

       a Unicode character set that can store characters from many

       different languages.

     * Manual Selected Default Character Set / Collation: Choose this

       option if you want to pick the server's default character set

       manually. Choose the desired character set from the provided

       drop-down list.

MySQL Installation Using a Source Distribution

   This section does not apply to MySQL Enterprise Server users.

   Before you proceed with an installation from source, first check whether our binary is available for your platform and whether it works for you. We put a great deal of effort into ensuring that our binaries are built with the best possible options.

   To obtain a source distribution for MySQL, Section 2.4.4, "How to Get MySQL." If you want to build MySQL from source on Windows, see Section 2.4.15.6, "Installing MySQL from Source on Windows."

   MySQL source distributions are provided as compressed tar archives and have names of the form mysql-VERSION.tar.gz, where VERSION is a number like 5.0.68.

   You need the following tools to build and install MySQL from source:

     * GNU gunzip to uncompress the distribution.

     * A reasonable tar to unpack the distribution. GNU tar is known   to work. Some operating systems come with a preinstalled version of tar that is known to have problems. For example, the tar provided with early versions of Mac OS X tar, SunOS 4.x and Solaris 8 and earlier are known to have problems with long filenames. On Mac OS X, you can use the preinstalled gnutar program. On other systems with a deficient tar, you should install GNU tar first.

     * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and SunPro C++ are some of the compilers that are known to work. libg++ is not needed when using gcc. gcc 2.7.x has a bug that makes it impossible to compile some perfectly legal C++ files, such as sql/sql_base.cc. If you have only gcc 2.7.x, you must upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is      also known to have problems on some platforms, so it should be avoided if a newer compiler exists for the platform. Gcc 2.95.2 or later is recommended.

     * A good make program. GNU make is always recommended and is sometimes required. (BSD make fails, and vendor-provided make implementations may fail as well.) If you have problems, we recommend GNU make 3.75 or newer.

     * libtool 1.5.24 or later is also recommended.

   If you are using a version of gcc recent enough to understand the -fno-exceptions option, it is very important that you use this option. Otherwise, you may compile a binary that crashes randomly.

   We also recommend that you use -felide-constructors and -fno-rtti long with -fno-exceptions. When in doubt, do the following:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \

       -fno-exceptions -fno-rtti" ./configure \

       --prefix=/usr/local/mysql --enable-assembler \

       --with-mysqld-ldflags=-all-static

The basic commands that you must execute to install a MySQL source distribution are:

shell> groupadd mysql

shell> useradd -g mysql mysql

shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -

shell> cd mysql-VERSION

shell> ./configure --prefix=/usr/local/mysql

shell> make

shell> make install

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> cd /usr/local/mysql

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> bin/mysql_install_db --user=mysql --force

shell> chown -R root .

shell> chown -R mysql var

shell> bin/mysqld_safe --user=mysql &

Note

   This procedure does not set up any passwords for MySQL accounts. After  following  the  procedure, proceed to Section 2.4.16, "Post-Installation Setup and Testing," for post-installation setup and testing.



   A  more  detailed  version  of the preceding description for installing MySQL from a source distribution follows:

    1. Add a login user and group for mysqld to run as:

shell> groupadd mysql

shell> useradd -g mysql mysql

       These commands add the mysql group and the mysql user. The syntax  for  useradd and groupadd may differ slightly on different versions of Unix, or they may have different names such as adduser and addgroup. You might want to call the user and group something else instead of mysql. If so, substitute the appropriate name in the following steps.

    2. Perform the following steps as the mysql user, except as noted.

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

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

    5. Unpack the distribution into the current directory:

shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -

       This command creates a directory named mysql-VERSION. With GNU tar, no separate invocation of gunzip is necessary. You can use the following alternative command to uncompress and extract the distribution:

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

    6. Change location into the top-level directory of the unpacked distribution:

shell> cd mysql-VERSION

       Note that currently you must configure and build MySQL from this top-level directory. You cannot build it in a different directory.

    7. Configure the release and compile everything:

shell> ./configure --prefix=/usr/local/mysql

shell> make

       When  you run configure, you might want to specify otheroptions. Run ./configure --help for a list of options. Section

       2.4.15.2, "Typical configure Options," discusses some of the more useful options. If configure fails and you are going to send mail to a MySQL mailing list to ask for assistance, please include any lines from config.log that you think can help solve the problem.

       Also  include  the  last  couple of lines of output from configure. To file a bug report, please use the instructions in Section 1.7, "How to Report Bugs or Problems." If the compile fails, see Section 2.4.15.4, "Dealing with Problems Compiling MySQL," for help.

    8. Install the distribution:

shell> make install

       You might need to run this command as root. If you want to set up an option file, use one of those present in the support-files directory as a template. For example:

shell> cp support-files/my-medium.cnf /etc/my.cnf

       You might need to run this command as root. If you want to configure support for InnoDB tables, you should edit the /etc/my.cnf file, remove the # character before the option lines that start with innodb_..., and modify the option values to be what you want. See Section 4.2.3.2, "Using Option Files," and Section 13.2.3, "InnoDB Configuration."

    9. Change location into the installation directory:

shell> cd /usr/local/mysql

   10. If you ran the make install command as root, the installed files will be owned by root. Ensure that the installation is accessible to mysql by executing the following commands as root in the installation directory:

shell> chown -R mysql .

shell> chgrp -R mysql .

       The first command changes the owner attribute of the files to the mysql user. The second changes the group attribute to the mysql group.

   11. If you have not installed MySQL before, you must create the MySQL data directory and initialize the grant tables:

shell> bin/mysql_install_db --user=mysql

       If you run the command as root, include the --user option as shown. If you run the command while logged in as mysql, you can omit the --user option. The command should create the data directory and its contents with mysql as the owner.

       After using mysql_install_db to create the grant tables for  MySQL, you must restart the server manually. The mysqld_safe command to do this is shown in a later step.

   12. Most of the MySQL installation can be owned by root if you like. The exception is that the data directory must be owned by mysql. To accomplish this, run the following commands as   root in the installation directory:

shell> chown -R root .

shell> chown -R mysql var

   13. If you want MySQL to start automatically when you boot your machine,  you can copy support-files/mysql.server to the location  where  your system has its startup files. More     information can be found in the support-files/mysql.server script itself; see also Section 2.4.16.2.2, "Starting andStopping MySQL Automatically."

   14. You can set up new accounts using the bin/mysql_setpermission script if you install the DBI and DBD::mysql Perl modules. See Section 4.6.16, "mysql_setpermission --- Interactively Set Permissions in Grant Tables." For Perl module installation instructions, see Section 2.4.21, "Perl Installation Notes."

   After  everything  has  been installed, you should test your distribution.  To  start the MySQL server, use the following command:

shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &

   If you run the command as root, you should use the --user option as shown. The value of the option is the name of the login account that you created in the first step to use for running the server. If you run the command while logged in as that user, you can omit the --user option.

   If the command fails immediately and prints mysqld ended, you can find  some information in the host_name.err file in the data directory.

Building MySQL from the Standard Source Distribution

   This section does not apply to MySQL Enterprise Server users.

   You can build MySQL on Windows by using a combination of cmake and Microsoft Visual Studio .NET 2003 (7.1), Micrsofot Visual Studio 2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must have the appropriate Microsoft Platform SDK installed.

Note

   To  compile from the source code usin CMake you must use the standard source distribution (for example, mysql-5.0.45.tar.gz). You build from the same distribution as sed to build MySQL on Unix, Linux and other platforms. Do not use the Windows Source distributions as they do not contain the necessary configuration script and other files.

   Follow this procedure to build MySQL:

    1. If you are installing from a packaged source distribution, create a work directory (for example, C:\workdir), and unpack the source distribution there using WinZip or another Windows       tool that can read .zip files. This directory is the work directory in the following instructions.

    2. If you are installing from a Bazaar tree, the root directory of  that  tree  is  the  work directory in the following instructions.

    3. Using a command shell, navigate to the work directory and run the following command:

C:\workdir>win\configure options

       These options are available:

          + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage engine.

          + WITH_PARTITION_STORAGE_ENGINE:  Enable user-defined partitioning.

          + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage engine.

          + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE storage engine.

          + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage engine.

          + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED  storage engine.

          + __NT__: Enable support for named pipes.

          + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.

          + COMPILATION_COMMENT=comment: Server comment, default"Source distribution".

          + MYSQL_TCP_PORT=port: Server port, default 3306.

          + DISABLE_GRANT_OPTIONS: Disables the the --bootstrap, --skip-grant-tables, and --init-file options for mysqld.

            This option is available as of MySQL 5.0.36.

       For example (type the command on one line):

C:\workdir>win\configure WITH_INNOBASE_STORAGE_ENGINE             WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro

    4. From the work directory, execute the win\build-vs8.bat or win\build-vs71.bat file, depending on the version of Visual Studio you have installed. The script invokes CMake, whichgenerates the mysql.sln solution file you will need to build MySQL using Visual Studio.. You can also use win\build-vs8_x64.bat to build the 64-bit version of MySQL. However, you cannot build the 64-bit version with Visual Studio Express Edition. You must use Visual Studio  2005 (8.0) or higher.

    5. From the work directory, open the generated mysql.sln file with Visual Studio and select the proper configuration using the Configuration menu. The menu provides Debug, Release, RelwithDebInfo, MinRelInfo options. Then select Solution >

       Build to build the solution. The build process will take some time. Please be patient.  Remember the configuration that you use in this step. It is important later when you run the test script because thatscript needs to know which configuration you used.

    6. You should test you build before installation. See Section 2.4.15.6.4, "Testing a Windows Source Build."

    7. To  install, use the instructions in Section 2.4.15.6.3, "Installing MySQL from a Source Build
分享到:
评论

相关推荐

    mysql-5.0.67.tar

    在Linux环境下,`mysql-5.0.67.tar`是一个源码包,需要通过编译来安装。安装过程通常包括解压、配置、编译和安装四个步骤: 1. **解压**: 使用`tar -zxvf mysql-5.0.67.tar`命令来解压缩文件。 2. **配置**: 运行`....

    Cacti installing for linux

    解压PHP源码包,配置、编译、安装,确保开启对MySQL的支持: ``` [root@svnserver01 ~]# tar -jxvf php-5.2.6.tar.bz2 [root@svnserver01 ~]# ./configure --prefix=/usr/local/...

    mysql5.0.67安装包(适合于FreeBSD6.4)

    4. **编译和安装**:执行 `make` 来编译源代码,然后使用 `make install` 来安装MySQL到指定的位置。 5. **初始化数据库**:安装完成后,使用 `mysql_install_db` 脚本来初始化数据库目录。 6. **设置权限**:确保...

    Linux 下安装 Mysql5.0

    在进行安装之前,首先需要获取MySQL 5.0.67的源代码包。可以通过MySQL官方网站或其他可信渠道下载`mysql-5.0.67.tar.gz`文件。这里推荐直接访问MySQL官方网站以确保下载到的是最新、最安全的版本。 #### 第二步:...

    linux下+mysql的安装和卸载.pdf

    对于二进制版本的MySQL,安装过程更为简单,不需要编译步骤。以下以`mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz`为例: 1. 改变文件权限: ``` # chmod 755 mysql-standard-4.1.13-pc-linux-gnu-i686.tar....

    apache、tomcat、mysql和jdk的安装整合

    Apache、Tomcat、MySQL 和 JDK 的安装整合 在本文中,我们将详细介绍在 Red Hat AS5 操作系统上安装和配置 Apache、Tomcat、MySQL 和 JDK 的过程。本文主要面向 Linux 操作系统用户,所有软件都将以源码包的方式...

    linux下mysql 5 安装

    ### Linux 下 MySQL 5.0.67 的安装与配置详解 #### 一、环境准备与软件包解压 在开始安装之前,请确保您的 Linux 系统已经安装了必要的依赖库,例如 `gcc`(GNU Compiler Collection)、`make` 等。这些工具通常...

    Linux Fedora6 + JDK6 + mysql5 + tomat5.5+MyEclipse5.5环境搭建.docx

    完成以上步骤后,你就拥有了一套完整的Linux Fedora 6上的Java开发环境,包括JDK 6用于编译Java代码,MySQL 5作为数据库存储,Tomcat 5.5作为应用服务器,以及MyEclipse 5.5作为集成开发环境,便于编写、调试和部署...

    Linux下安装并配置Apache+PHP+MySQL

    2. **配置编译选项**:根据需求配置相应的编译参数,例如启用MySQL模块支持、指定安装路径等。 3. **编译并安装**:运行 `make` 和 `make install` 命令完成编译和安装过程。 4. **配置Apache支持PHP**:编辑Apache...

    Red_Hat_Enterprise_Linux_5_环境下安装配置

    2. **MySQL**: mysql-5.0.67.tar.gz 3. **PHP**: php-5.2.6.tar.gz 4. **Zend Optimizer**: ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz 5. **libpng**: libpng-1.2.32.tar.gz 6. **GD**: gd-2.0.36rc1.tar.gz 7...

    ubuntu下安装nagios指南

    # 下载Nagios源码并编译安装 # 安装NRPE、SNMP、ndoutility等 # 配置Nagios服务 # 配置Apache虚拟主机 ``` 完成所有安装和配置后,重启Apache和MySQL服务,使改动生效。至此,Nagios已在Ubuntu 8.10上成功安装并配置...

    php平台搭建过程,步骤

    2. **编译与安装**:创建安装目录,进行配置、编译和安装。 ```bash sudo mkdir -p /usr/local/apache2 cd httpd-2.2.11 sudo ./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite ...

    linuxnginx安装配置文件支持php.pdf

    - 使用`make && make install`编译和安装MySQL - 复制my-medium.cnf到/etc/my.cnf并修改权限 4. 配置PHP支持: - 下载并解压PHP源代码(如php-5.2.6.tar.bz2) - 应用PHP-FPM补丁(php-5.2.6-fpm-0.5.9.diff.gz...

    LAMP环境搭建

    1. 解压安装包:`tar -zxvf mysql-5.0.67.tar.gz` 2. 创建MySQL用户和组:`groupadd mysql` 和 `useradd -g mysql -s /sbin/nologin -M mysql` 3. 配置编译选项:`./configure --prefix=/usr/local/mysql --with-...

    Apache+PHP+Tomcat+Mysql.pdf

    通过tar命令解压mysql-5.0.67.tar.gz文件,并按照MySQL官方文档的说明进行编译和安装。安装过程中,可能需要创建mysql用户和用户组,配置好***f文件,并执行mysql_install_db脚本初始化数据库。安装完成后,设置环境...

    数据库及JAVA

    2. **解压与启动安装**:解压缩mysql-5.0.67-win32.zip文件,双击Setup.exe开始安装过程。 3. **安装类型选择**:在安装向导中,选择“Custom”模式,以便自定义安装路径。 4. **组件与路径选择**:选择安装组件并...

    在Windows XP下建立Apache+PHP+Tomcat+Perl的开发环境

    - 下载`mysql-5.0.67-win32.exe`安装程序。 - 按照“详细配置”&gt;“开发机器”&gt;“多功能数据库”&gt;“InnoDB表空间设置”的顺序进行配置。 - 设置默认15个并发连接。 2. **安装Apache 2.2.3**: - 下载并解压Apache...

Global site tag (gtag.js) - Google Analytics