Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92423729
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Mysql/postgreSQL

2008-04-06 10:58:20

作者: gfhlole  出自:
说明:本人在参考网上的资料的基础上,自己钻研后安装,现在在公司运行的非常ok。

一,安装好centos,安装时我把所有的开发工具包都选中,给装上了。

二、获得mysql-max-5.0.27-linux-i686-glibc23.tar.gz ,这个请大家从网上自己下,找不到的,请E-mail通知我, 我发给需要者。

三、进入正题,安装了。首先解压,我一般放在/usr/local/ 目录下

# cp mysql-max-5.0.27-linux-i686-glibc23.tar.gz /usr/local/

#tar xxzvf mysql-max-5.0.27-linux-i686-glibc23.tar.gz

# mv mysql-max-5.0.27-linux-i686-glibc23 mysql

四、建立mysql配置文件

# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf //在support-files目录下有4个模版文件,我们选择其中一个作为Mysql的配置文件。my.cnf (其中设置 了性能参数和Mysql的一些路径参数)

五、建立mysql用户和mysql组

#groupadd msyql

#useradd -g mysql mysql

六、初始化mysql

#/usr/local/mysql/scripts/mysql_install_db --user=mysql

出现如下提示表示,初始化mysql正确。

Installing all prepared tables
Fill help tables

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

You can start the MySQL daemon with:
cd . ; ./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 ./bin/mysqlbug script!

The latest information about MySQL is available on the web at

Support MySQL by buying support/licenses at

出现如下报错,我没有处理这个问题,仍就继续安装,有时mysql仍可正常运行,这个报错有待解决,请大家都来讨论讨论。

/usr/local/mysql/scripts/mysql_install_db: line 85: my_print_defaults: command not found
Could not find help file 'fill_help_tables.sql' in ./support-files or inside ..

在这之后,我又研究了一下,严格按照上面的步骤,都没有报错了。

七、更改目录权限 (当前目录为 /usr/local/mysql )

# chown -R root .
#chgrp -R mysql .

#chown -R mysql data

八、启动mysql

# /usr/local/mysql/bin/mysqld_safe --user=mysql &

//运行mysql,如果没有问题的话,应该会出现类似这样的提示# Starting mysqld daemon with databases from /usr/local/mysql/var 如果出现 mysql ended这样的语句,表示Mysql没有正常启动,你可以到log中查找问题,Log文件的通常在/etc/my.cnf中配 置。大多数问题是权限设置不正确引起的。

九、设置mysql的管理密码
# /usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'

//默认安装密码为空,为了安全你必须马上修改.


十、修改字符集

修改默认字符集--: database_character_server=utf8
配置/etc/my.cnf,在 [client] 和 [mysqld] 节中加入:
default-character-set = gbk
(或者default-character-set = utf8)


十一、是mysql随OS启动而启动
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

# chmod 700 /etc/init.d/mysqld

# chkconfig --add mysqld

# chkconfig --level 345 mysqld on



十二、启动mysql
# service mysqld start

# netstat -atln //查看3306端口是否打开。要注意在防火墙中开放该端口。

十三、client测试

从centos DVD盘中找到这两个mysql在linux下的client端包,并安装。

#rpm -ivh mysqlclient10-3.23.58-4.RHEL4.1.i386.rpm

#rpm -ivh mysqlclient10-devel-3.23.58-4.RHEL4.1.i386.rpm

#vi /root/bash_profile

把其中的

PATH=$PATH:$HOME

改为

PATH=$PATH:$HOME/bin:/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 9 to server version: 5.0.27-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

安装完毕。
阅读(473) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~