记录一下步骤,备忘。
1. 首先配置一下 yum 的源,指向光驱。
(1) 光驱中放入系统盘
(2) mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
(3) 备份一下 yum 原始配置:
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
(4) 修改配置 vim /etc/yum.repos.d/CentOS-Base.repo
在文件末尾添加如下内容:
[DVDROM]
name=myyum
baseurl=file:///mnt/cdrom/
gpgcheck=0
enabled=1
好了,配置完成。
2. 使用 yum 命令安装 mysql
yum groupinstall mysql
分析完后,可能有个下载询问, 更新一点内容,内容不大。输入 y [回车]
mysql就自动装好了, 太方便了。
3. 查看一下有没有mysql服务
chkconfig --list | grep mysql
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
4. 启动mysqld
/etc/init.d/mysqld start
starting MySQL: [ok]
5. 修改root账号密码
mysqladmin -u root password '123456'
6. 连接到mysql
mysql -u root -p
输入密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
好了,内容就到这里了。