LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2169|回复: 22

MySql安装问题,困扰我一年多了!

[复制链接]
发表于 2005-3-17 10:31:31 | 显示全部楼层 |阅读模式
我是按MySql官安装说明进行安装的,但执行到9时,也就是 bin/mysql_install_db --user=mysql 这一句时得到如下提示idn't find /usr/libexec/mysqld
You should do a 'make install' before executing this script
请高手指点一二,我的系统就RH9.0内核2.6.11.2
2.8.1 Source Installation Overview

The basic commands 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> bin/mysql_install_db --user=mysql
shell> chown -R root  .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

For versions of MySQL older than 4.0, substitute bin/safe_mysqld for bin/mysqld_safe in the final command.

If you start from a source RPM, do the following:

shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm

This will make a binary RPM that you can install. For older versions of RPM, you may have to replace the command rpmbuild with rpm instead.

Note: This procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to section 2.9 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. They may also be called 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. Pick the directory under which you want to unpack the distribution, and change location into it.
   3. Obtain a distribution file from one of the sites listed in section 2.1.3 How to Get MySQL.
   4. 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

   5. 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.
   6. Configure the release and compile everything:

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

      When you run configure, you might want to specify some options. Run ./configure --help for a list of options. section 2.8.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. Post the bug report using the mysqlbug script. See section 1.4.1.3 How to Report Bugs or Problems. If the compile fails, see section 2.8.4 Dealing with Problems Compiling MySQL for help.
   7. Install the distribution:

shell> make install

      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 these commands 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.3.2 Using Option Files and section 15.4 InnoDB Configuration.
   8. Change location into the installation directory:

shell> cd /usr/local/mysql

   9. If you haven't installed MySQL before, you must create the MySQL grant tables:

shell> bin/mysql_install_db --user=mysql

      If you run the command as root, you should use the --user option as shown. The value of the option should be 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. Note that for MySQL versions older than 3.22.10, mysql_install_db left the server running after creating the grant tables. This is no longer true; you will need to restart the server after performing the remaining steps in this procedure.
 楼主| 发表于 2005-3-17 10:38:29 | 显示全部楼层

MySql安装问题,困扰我一年多了!

我是按MySql官安装说明进行安装的,但执行到9时,也就是 bin/mysql_install_db --user=mysql 这一句时得到如下提示idn't find /usr/libexec/mysqld
You should do a 'make install' before executing this script
请高手指点一二,我的系统就RH9.0内核2.6.11.2
2.8.1 Source Installation Overview

The basic commands 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> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

For versions of MySQL older than 4.0, substitute bin/safe_mysqld for bin/mysqld_safe in the final command.

If you start from a source RPM, do the following:

shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm

This will make a binary RPM that you can install. For older versions of RPM, you may have to replace the command rpmbuild with rpm instead.

Note: This procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to section 2.9 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. They may also be called 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. Pick the directory under which you want to unpack the distribution, and change location into it.
3. Obtain a distribution file from one of the sites listed in section 2.1.3 How to Get MySQL.
4. 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

5. 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.
6. Configure the release and compile everything:

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

When you run configure, you might want to specify some options. Run ./configure --help for a list of options. section 2.8.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. Post the bug report using the mysqlbug script. See section 1.4.1.3 How to Report Bugs or Problems. If the compile fails, see section 2.8.4 Dealing with Problems Compiling MySQL for help.
7. Install the distribution:

shell> make install

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 these commands 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.3.2 Using Option Files and section 15.4 InnoDB Configuration.
8. Change location into the installation directory:

shell> cd /usr/local/mysql

9. If you haven't installed MySQL before, you must create the MySQL grant tables:

shell> bin/mysql_install_db --user=mysql

If you run the command as root, you should use the --user option as shown. The value of the option should be 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. Note that for MySQL versions older than 3.22.10, mysql_install_db left the server running after creating the grant tables. This is no longer true; you will need to restart the server after performing the remaining steps in this procedure.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-17 11:39:41 | 显示全部楼层
继续顶!有人指点吗?
回复 支持 反对

使用道具 举报

发表于 2005-3-17 12:02:39 | 显示全部楼层
kneral升级困饶了近一年,哈

[root@linuxsir01 root]# rpm -qa | grep mysql
libdbi-dbd-mysql-0.6.5-7
mod_auth_mysql-20030510-3
php-mysql-4.3.3-6
mysql-3.23.58-4
mysql-bench-3.23.58-4
mysql-server-3.23.58-4
freeradius-mysql-0.9.1-1
mysql-devel-3.23.58-4
[root@linuxsir01 root]#

卸载过程:是从最下面的一个包开始,因为有些东西是有顺序的。所以这是要注意的。

在这里,我们应该先应该把mysql-devel-3.23.58-4卸掉,然后才是freeradius-mysql-0.9.1-1等, 要一个一个的来;

方法是:
[root@linuxsir01 root]#rpm -e mysql-devel

再举一例:比如我们想卸载php-mysql-4.3.3-6,应该用下面的办法

[root@linuxsir01 root]#rpm -e php-mysql

这回应该明白了吧

如果有卸不掉的,就是有顺序,比如和php相关的,当然要先卸php

1]解压
[root@linuxsir01 root]# cd /opt/software

[root@linuxsir01 software]# ls
mysql-4.0.16.tar.gz

[root@linuxsir01 software]#tar zxvf mysql-4.0.16.tar.gz

2]编译和安装:在这个地方值得注意的是,我们要把mysql-4.0.16安装到我们指定的目录中,为了系统和安全和优化,建议把自己用源码包安装的服务器类软件都放在/opt 目录里。所以在这里,我们就要把mysql-4.0.16也安装到/opt/mysql这个目录中;
[root@linuxsir01 software]#cd

[root@linuxsir01 software]# cd mysql-4.0.16
[root@linuxsir01 mysql-4.0.16]#
./configure --prefix=/opt/mysql --with-mysqld-user=beinan --with-charset=gb2312 --with-extra-charsets=all --with-unix-socket-path=/opt/mysql/var/mysql.sock

[注]关于configure的选项的一点说明:

--prefix=/opt/mysql 把mysql-4.0.16指定安装到/opt/mysql目录中;
--with-charset=gb2312 指定mysql默认语言为gb2312,也就是中文;
--with-extra-charsets=all 对多语言的支持;
--with-unix-socket-path=/opt/mysql/var/mysql.sock 这个是指定mysql服务器启动后,联机套接字文件所处的位置和文件名,也就是说,如果mysql服务器成功启动后,就能在/opt/mysql/var目录中看到mysql.sock文件。如果看不到,肯定是mysql启动不了。
--with-mysqld-user=beinan 这个是让mysql服务器也能让系统中普通用户beinan也能启动mysql服务器。当然要活学活用了你也可以把beinan换成你的系统中已经存在的普通用户,比如您的系统中已经存在sir这个用户,那就把beinan替换成sir就行了。用普通用户来启动mysql的好处是:mysql的进程会自己死掉自动退出。当然root用户也可以,不过有时mysql有些进程死了,但不会自动退出,root自己也杀不掉。所以用普通用户就有这样的好处,大多不会出现mysql进程已死,但不会退出的情况;

[root@linuxsir01 mysql-4.0.16]#make

[root@linuxsir01 mysql-4.0.16]#make install

这样就安装完了

3]配制mysql:安装只是第一步,我们还要对mysql进行相应的配制;

一般的情况下mysql要找配制文件my.cnf,位置在/etc目录下,所以我们得把文件my.cnf文件放到/etc/目录下。让mysql服务器启动时能找到它。

我们安装好mysql后,配制文件应该在/opt/mysql/share/mysql目录中,配制文件有几个,比如my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf
,不同的流量的网站和不同配制的服务器环境,当然需要有不同的配制文件了。一般的情况下,my-medium.cnf这个配制文件就能满足我们的大多需要;

进入/opt/mysql这个目录,看一下是不是已经安装好了呢??

[root@linuxsir01 mysql-4.0.16]# cd /opt/mysql/
[root@linuxsir01 mysql]# ls
bin include info lib libexec man mysql-test share sql-bench

我们把/opt/mysql/share/mysql这个目录下的my-medium.cnf,复制为my.cnf到/etc目录下。
[root@linuxsir01 mysql]# cp /opt/mysql/share/mysql/my-medium.cnf /etc/my.cnf

做了这些工作以后,还得创造MySQL授权表, 否则数据库也是启动不了。mysql_install_db,这个命令的用途就是做这个的。mysql的命令都安装到了/opt/mysql/bin这个目录中。

[root@linuxsir01 mysql]#/opt/mysql/bin/mysql_install_db

运行mysql_install_db命令过后,我们查看/opt/mysql就会发现,有个var的目录。这个目录,就是用来装所有数据库的位置,比如我们创建了linuxsir的数据库后,就在在/opt/mysql/var目录中有linuxsir的目录。这回应该明白了吧。

4]启动mysql服务器,可能这是最轻松的了,不过也不能高兴的太早,因为有时会出现权限方面的错误。

mysql服务器启动,应该是/opt/mysql/share/mysql目录中的 mysql.server
启动方法是:
[root@linuxsir01 mysql]# /opt/mysql/share/mysql/mysql.server start


摘自好象是北南发的帖子,我改了改,哪里改了,我忘了,肯定能行
回复 支持 反对

使用道具 举报

发表于 2005-3-17 12:39:11 | 显示全部楼层
前面几步都正确么?没出错信息么?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-17 17:24:49 | 显示全部楼层
我装的是mysql-5.0.2-alpha.tar.gz
前几步都没错,就在执行下面一句时出错了
# bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
ERROR: 1153 Got a packet bigger than 'max_allowed_packet' bytes
050317 16:22:47 [ERROR] Aborting

050317 16:22:47 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!
The "HELP" command might not work properly


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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h aluo password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/local/mysql/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-17 17:25:57 | 显示全部楼层
soccer 你好,我照着你帖的做了,还是出现如下所示错误:
# bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
ERROR: 1153 Got a packet bigger than 'max_allowed_packet' bytes
050317 16:22:47 [ERROR] Aborting

050317 16:22:47 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!
The "HELP" command might not work properly


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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h aluo password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/local/mysql/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
回复 支持 反对

使用道具 举报

发表于 2005-3-17 20:48:27 | 显示全部楼层
上面的文章可能是我写的, 当时可能没有写太清楚。

这样吧。如果兄弟信任我的话,给我开个帐号,把ssh服务器启动起来。我来试试看??

如果能行,请给我来个悄悄话。

另原来可能出在 my.cnf上。查看一下这个配置文件中信息出的那项的值。
回复 支持 反对

使用道具 举报

发表于 2005-3-17 21:26:17 | 显示全部楼层
mysql是作什么用的???
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-17 21:45:51 | 显示全部楼层
顶一下了!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表