Redhat下mysql的安装与使用

一、 下载与安装
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,成功!
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北雨南萍

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值