免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2516 | 回复: 0
打印 上一主题 下一主题

自定义安装 MySQL (mysql-max-5.0.27-linux-i686-glibc23) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-20 14:36 |只看该作者 |倒序浏览

             自定义安装 MySQL (mysql-max-5.0.27-linux-i686-glibc23)

2008-6-20
       昨天偶尔使用二进制方式来安装mysql,发现根本不会装了。
       不会装的原因如下,时间长了肯定会忘记,又没有做好对应的记录,导致无从下手,甚至连帮助除了README之外,不知找INSTALL-BINARY。今后一定要强化文档的书写和管理。书写要体现在没有坐个这个东东的人员照着文档能有用。管理体现在要能方便快速查找。文档重在理解,该整合的要整合,绝对不能凑数量。
              磁针石
联系方式: QQ:37391319 gmail and gtalk:
xurongzhong@gmail.com

原文地址:
http://hi.baidu.com/rambochow/blog/item/bc7a6e90798d248ea877a469.html
自定义安装 MySQL
(mysql-max-5.0.27-linux-i686-glibc23)
2007-10-11 下午 03:56

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> tar -xzvf mysql-max-5.0.27-linux-i686-glibc23.tar.gz
shell> ln -s mysql-max-5.0.27-linux-i686-glibc23 mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
1.安装版本的选择:
这里使用较新的mysql5.0 安装。注意 mysql 官方不建议使用Tarball(Source Code)方式安装,所以我们采用由mysql自己编译好的binary方式来安装,简单。当然,mysql还给Redhat企业版等提供了Rpm的安装包。
2.下载 (
http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-max-5.0.27-linux-i686-glibc23.tar.gz
)

这里要注意了,由于glibc的版本不同需要下载相应的tar.gz,看看自己的glibc版本
# rpm -qa | grep glibc
glibc-common-2.3.2-11.9
glibc-2.3.2-11.9
glibc-kernheaders-2.4-8.10
glibc-devel-2.3.2-11.9
我的机器上是2.3.2,所以我下载了mysql-max-5.0.27-linux-i686-glibc23.tar.gz
保存到/home/xqiang
(选择max ,免得有什么功能没有安装,哈哈)
3.建立mysql需要的用户和组

# groupadd mysql
# useradd -g mysql mysql
4.解压缩
# cd /usr/local
# tar -xzvf /home/xqiang/mysql-max-5.0.27-linux-i686-glibc23.tar.gz
# ln -s /usr/local/mysql-max-5.0.27-linux-i686-glibc23 mysql
5.生成系统数据库
# cd /usr/local/mysql (如果不是在这个目录下操作则会出现《问题一》)
# scripts/mysql_install_db --user=mysql (这里会出现《问题二》,不用理它)
6.修改mysql目录权限

# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
(以上两句可以直接#chown -R root:mysql /usr/local/mysql)
# chown -R mysql /usr/local/data
操作mysql数据库的用户是mysql 所以要拥有数据库目录的所有权
7.启动mysql
# /usr/local/mysql/bin/mysqld_safe --user=mysql &
注意: 执行完这个命令后,会在/tmp产生一个mysql.sock 的文件
这是访问mysql必须的!
8.将配置文件拷贝到/etc
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
9.设置MYSQL的中文问题(这一步在创建用户数据库之前完成,并要重启MYSQL)
# vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=gb2312 //添加的内容
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8 //添加的内容
另外,mysql目录下有一个安装文件 INSTALL-BINARY ,介绍了安装的步骤!
其他设定:
关于mysql的一些配置项可以在/etc/my.cnf 中更改!
设置mysql执行程序的path:
# vi /etc/profile
添加:
PATH=$PATH:/usr/local/mysql/bin
export PATH
设置mysql启动
# /usr/local/mysql/bin/mysqld_safe --user=mysql & (启动MySQL,但不能停止)
使用mysql 提供的脚本
# cp /usr/local/mysql/support-files/mysql.server /usr/local/mysql/bin
# mysql.server start 启动mysql
# mysql.server stop 停止mysql
随系统自动启动
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
# chkconfig --add mysql
修改mysql超级用户root的密码
# mysqladmin -u root -p password '123456'
Enter password:
回车就行 ,默认的密码为空
最好完成这一步:
# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
# ln -s /usr/local/mysql/include/mysql /usr/include/mysql
问题一:
    my_print_defaults:
command not found
Could not find help file 'fill_help_tables.sql' in ./support-files or inside ..
问题二:
Installing all prepared tables
Fill help tables
HELP FILES CAN NOT COMPLETE INSTALL
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.
NOTE:    If you are upgrading from a MySQL 3.22.10
you should run
the ./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 . ; ./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
http://www.mysql.com
Support MySQL by buying support/licenses at
https://order.mysql.com

               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21908/showart_1006066.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP