Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7810796
  • 博文数量: 701
  • 博客积分: 2150
  • 博客等级: 上尉
  • 技术积分: 13233
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-29 16:28
个人简介

天行健,君子以自强不息!

文章分类

全部博文(701)

文章存档

2019年(2)

2018年(12)

2017年(76)

2016年(120)

2015年(178)

2014年(129)

2013年(123)

2012年(61)

分类: Mysql/postgreSQL

2015-09-30 15:13:44

一、 下载与安装
1.1 查看本机的linux相关信息:
$ cat /proc/version
Linux version 2.6.18-194.el5 (mockbuild@x86-005.build.bos.redhat.com) 
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) 
#1 SMP Tue Mar 16 21:52:39 EDT 2010

信息内容为:
Linux version 2.6.18-194.el5 : linux内核版本号
gcc version 4.1.2 20080704   : gcc编译器版本号
Red Hat 4.1.2-48             : Red Hat版本号

$ uname -a
Linux ltv_13 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

信息内容为:
ltv_13           : 主机名,即hostname
2.6.18-194.el5   : linux内核版本号
x86_64           : 64位的操作系统,如果是32位的则是i386

1.2 安装
下载链接:
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz
1. 下载
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz
2.添加用户和组:
  #groupadd mysql
  #useradd -g mysql mysql
3.解压安装包:
  #tar -zxvf mysql-5.1.51.tar.gz
4. 进入目录:
  #ls
  #cd mysql-5.1.51
5. 建立安装目录
  #mkdir /usr/mysql
6. 配置安装路径:
  #ls
  #./configure --prefix=/usr/mysql
7.编译安装:
  #make
  #make install

安装成功则进行下一步
8. # /usr/mysql/bin/mysql_install_db --user=mysql
9. 修改配置文件
  #cd /root/mysql-5.1.51
  #ls
执行:
  #cp support-files/my-medium.cnf /etc/my.cnf
  #cp support-files/mysql.server /etc/rc.d/init.d/mysqld
  #chmod 700 /etc/rc.d/init.d/mysqld
  #chkconfig --add mysqld
10. 修改权限:
  #cd /usr/mysql
  #chown -R root .
  #chown -R mysql var
  #chown -R mysql .

11. 启动mysql
  #/usr/mysql/bin/mysqld_safe --user=mysql &
12. 登录mysql:
  #bin/mysql -u root -p
提示输入密码,由于安装时未设置,直接按回车。显示如下表示安装成功:
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.51-log Source distribution

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


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

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

mysql> quit;

二、给root用户添加密码
修改密码
格式:mysqladmin -u用户名 -p旧密码 password 新密码

1、给root加个密码ab12。
首先在DOS下进入目录mysql\bin,然后键入以下命令
    mysqladmin -u root -password ab12
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。

2、再将root的密码改为djg345。
    mysqladmin -u root -p ab12 password djg345


三、RedHat安装mysql时执行./configure后出现如下错误:
checking for termcap functions library… configure: error: No curses/termcap library found
说明 curses/termcap 库没有安装,解决方法如下:
下载一个ncurses-5.6.tar.gz,
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
#tar zxvf ncurses-5.6.tar.gz
#cd ncurses-5.6
#./configure –prefix=(路径)
#make
#make install
此时重新执行configure,错误依旧。执行:
./configure --with-named-curses-libs=/usr/lib/libncurses.so.5

看到Thank you for choosing Mysql 
OK,成功!
阅读(1540) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~