1 准备
- rhel-server-6.5-i386-dvd.iso
2 创建本地安装源
将系统安装的镜像文件rhel-server-6.5-i386-dvd.iso
拷贝至/root
目录下。
2.1 挂载镜像
# mount -t iso9660 -o loop /root/rhel-server-6.5-i386-dvd.iso /mnt
2.2 删除旧安装源
# rm -rf /etc/yum.repos.d/*
2.3 创建新安装源dvd.repo
打开/etc/yum.repos.d/dvd.repo
,添加以下内容
# vim /etc/yum.repos.d/dvd.repo
[dvd]
name=install dvd
baseurl=file:///mnt
enabled=1
gpgcheck=0
2.4 刷新repos,生成缓存
# yum makecache
3 安装Mysql环境
3.1 安装Mysql包
# yum -y install mysql-server mysql mysql-devel
3.2 查看安装包
# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.i686
mysql-server-5.1.71-1.el6.i686
mysql-5.1.71-1.el6.i686
mysql-devel-5.1.71-1.el6.i686
3.3 启动Mysql服务
# service mysqld start
Starting mysqld: [ OK ]
3.4 配置Mysql
- 修改root密码
mysql安装完后,默认的root密码为空,需要修改密码。
mysqladmin -u root password "123456";
- 确认密码已修改
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.71 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
- 允许本地和远程连接
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.5 设置开机启动项
在/etc/rc.d/rc.local
文件末尾添加一行service mysqld start