Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15056324
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 17:55:20

1.Add a login user and group for `mysqld' to run as:为‘mysqld’增添一个登陆用户和组
 shell> groupadd mysql
 shell> useradd -g mysql mysql

2.解压
 shell> gunzip < mysql-5.0.15.tar.gz | tar -xvf -
 shell> cd mysql-5.0.15

3.Configure the release and compile everything:配置和编译给configure分配可执行文件
 shell> chmod +x configure
改变字符集为 GBK [默认字符集为ISO-8859-1(Latin1)]
 shell> ./configure --prefix=/usr/local/mysql --with-charset=gbk
 shell> make
(字符集还有big5、cp1251、cp1257、czech、danish、dec8、dos、euc_kr、gb2312 gbk、german1、hebrew、 hp8、hungarian、koi8_ru、koi8_ukr、latin1、latin2、sjis、swe7、tis620、ujis、usa7、win1251或win1251ukr)

4.安装所有东西
 shell> make install

5.如果你想安装选项文件,使用当前存在的‘support-files’ 文件夹下的作为模板,例如:
 shell> cp support-files/my-medium.cnf /etc/my.cnf

6.如果想mysqld每次开机自动启动的话。cp -r support-files/mysql.server /etc/init.d/就行了
 shell> cp -r support-files/mysql.server /etc/init.d/mysql
 shell> cd /etc/rc.d/init.d
 shell> chmod +x mysql
 shell> /sbin/chkconfig --del mysql
 shell> /sbin/chkconfig --add mysql

7.进入安装目录
 shell> cd /usr/local/mysql

8.如果你以前没有安装过MySQL,你必须创建一个MySQL准许的表
 shell> bin/mysql_install_db --user=mysql

9.将程序的所有权限给‘root’ ,并且把数据目录的所有权给可以运行‘mysqld’的用户。假设MySQL的安装目录是(‘/usr/local/mysql’),命令如下所示:
把文件拥有权给‘root’
 shell> chown -R root  .
把数据目录拥护权给‘mysql’用户
 shell> chown -R mysql var
把组的权限给'mysql'组
 shell> chgrp -R mysql .

10.万事具备后,你就可以按照下面的命令测试并运行你的MySQL了:
 shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
 shell> service mysql start

11.在一切正常后,要做的第一件事情是更改管理员的密码。你可以运行mysqladmin (请注意,此命令不一定在你的path中,所以最好是转到此命令的目录中直接执行):
 shell> cd bin
 shell> ./mysqladmin -u root password *********

12.运行其他用户访问本机:
 shell> ./mysql -u root -p mysql
 --------------------这里输入你刚才修改的管理员密码
 mysql> update user set host='' where host='localhost' and user='root';
 mysql> exit
 Bye

13.修改mysql数据库端口号
 shell> vi /etc/my.cnf
 --------------------修改里面的 port=**** 为你需要的端口号

14.重启应用
 shell> service mysql restart

阅读(952) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~