Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4463182
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: Mysql/postgreSQL

2011-08-03 18:40:21

1. 下载 mysql-5.1.51.tar.gz
   


2. 解压 ,注意都在 root权限下进行
  

  1. root@ywx:/home/ywx/yu/mysql# tar zxfv mysql-5.1.51.tar.gz
 
3. 配置 configure

  1. ./configure --prefix=/opt/mysql5151/ \
  2. --without-debug \
  3. --enable-assembler \
  4. --enable-thread-safe-client \
  5. --enable-profiling \
  6. --with-mysqld-ldflags=-all-static \
  7. --with-client-ldflags=-all-static \
  8. --with-charset=latin1 \
  9. --with-extra-charset=utf8,gbk \
  10. --with-mysqld-user=mysql1 \
  11. --without-ebmedded-server \
  12. --with-server-suffix=bbk \
  13. --with-plugins=innobase,partition

4. 安装 源码

  1. root@ywx:/home/ywx/yu/mysql/mysql-5.1.51# make;make install

5. 在/opt/mysql5151/ 建立 data

  1. root@ywx:/opt/mysql5151# mkdir data
  2. root@ywx:/opt/mysql5151#chown ywx:ywx ./data/ -R
 chown ywx:ywx ./data/ -R  ; ywx:ywx 用户组:用户名


6.复制配置文件

  1. root@ywx:/opt/mysql5151# cp /home/ywx/yu/mysql/mysql-5.1.51/support-files/my-small.cnf ./my.cnf

7.修改my.cnf

  1. thread_stack = 128K

  2. basedir=/opt/mysql5151 添加
  3. datadir=/opt/mysql5151/data  添加

8. 配置文件

  1. root@ywx:/opt/mysql5151# ./bin/mysql_install_db --user=ywx

root@ywx:/opt/mysql5151# ./bin/mysqld_safe --defaults-file=./my.cnf --user=ywx



 select version();

9. 启动mysql

  1. root@ywx:/opt/mysql5151# ./bin/mysql --defaults-file=./my.cnf
  2. Welcome to the MySQL monitor. Commands end with ; or \g.
  3. Your MySQL connection id is 2
  4. Server version: 5.1.51bbk Source distribution

  5. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  6. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  7. and you are welcome to modify and redistribute it under the GPL v2 license

  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  9. mysql>

在安装好的目录 data下,包括日志文件,进程文件,错误文件



10.重新启动电脑,我们来试着 使用 mysql


   1. 启动数据库服务,注意是在后台服务的。root 权限
  1. ywx@ywx:~/yu$ sudo /opt/mysql5151/bin/mysqld_safe --defaults-file=/opt/mysql5151/my.cnf --user=ywx &
  
    2. 启动数据库,可以在 用户模式下
  1. ywx@ywx:~/yu$ /opt/mysql5151/bin/mysql --defaults-file=/opt/mysql5151/my.cnf

  1. Welcome to the MySQL monitor. Commands end with ; or \g.
  2. Your MySQL connection id is 1
  3. Server version: 5.1.51bbk Source distribution

  4. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  5. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  6. and you are welcome to modify and redistribute it under the GPL v2 license

  7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  8. mysql>


  1. mysql> show databases;
  2. +--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | test |
  7. +--------------------+
  8. 2 rows in set (0.03 sec)

  9. mysql> select version();
  10. +-----------+
  11. | version() |
  12. +-----------+
  13. | 5.1.51bbk |
  14. +-----------+
  15. 1 row in set (0.00 sec)

  16. mysql> exit
  17. Bye
  18. ywx@ywx:~/yu$

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