linux yum 是否安装mysql数据库_mysql在linux上的安装之一yum安装 - mysql数据库栏目

mysql在linux上的安装之一yum安装 - mysql数据库栏目

来源:自学PHP网

时间:2015-04-16 10:50 作者:

阅读:次

[导读] mysql的安装无非以下几种,其中yum安装也是rpm安装中的一种,只不过这种不需要再单独下载安装包,直接根据操作系统自带的mysql包进行安装,比较简单,本篇主要对yum进行讲解,后续会...

mysql的安装无非以下几种,其中yum安装也是rpm安装中的一种,只不过这种不需要再单独下载安装包,直接根据操作系统自带的mysql包进行安装,比较简单,本篇主要对yum进行讲解,后续会对其它几种方式进行总结。

目前的安装方式

1,rpm 安装

2,二进制安装

3,源码安装

4,yum安装

yum方式安装

1. 安装操作系统

1.1安装Red Hat Enterprise Linux 6.2 (64-bit)

arch: x86_64

1.2. 关闭selinux vi /etc/selinux/config

1.3. service iptables stop 临时关闭防火墙

2 安装数据库MySQL

2.1挂载Redhat镜像文件 ftp://192.168.0.212/pub/iso/rhel6.2/,命令如下

#mkdir -p /mnt/iso

#mkdir -p /mnt/redhat5.5

# mount 192.168.0.212:/var/ftp/pub/iso/rhel5.5/ /mnt/iso/

# mount -t iso9660 -o loop rhel-server-5.5-x86_64-dvd.iso /mnt/redhat5.5/

2.2 配置yum

# cd /etc/yum.repos.d/

# cp rhel-debuginfo.repo rhel-debuginfo.repo_bak

# vi rhel-debuginfo.repo

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///mnt/redhat5.5/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[oracle@Redhat5 yum.repos.d]$ ls

el5u5.repo el5u8.repo rhel-debuginfo.repo

[oracle@Redhat5 yum.repos.d]$ cat el5u8.repo

[Server]

name=Red Hat Enterprise Linux 5 update 8

baseurl=ftp://192.168.0.212/pub/src/RHEL5U8/x64/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]

name=Red Hat Enterprise Linux 5 update 8

baseurl=ftp://192.168.0.212/pub/src/RHEL5U8/x64/VT

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]

name=Red Hat Enterprise Linux 5 update 8

baseurl=ftp://192.168.0.212/pub/src/RHEL5U8/x64/Cluster

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]

name=Red Hat Enterprise Linux 5 update 8

baseurl=ftp://192.168.0.212/pub/src/RHEL5U8/x64/ClusterStorage

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

2.3根据需求创建mysql数据存储目录

# mkdir /mysqldata

2.4 yum安装mysql,mysql-server

# yum install mysql mysql-server

2.5 修改mysql配置文件

# vi /etc/my.cnf

[mysqld]

datadir=/data/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

old_passwords=1

default-character-set=utf8

# Disabling symbolic-links is recommended to prevent assorted security risks;

# to do so, uncomment this line:

# symbolic-links=0

lower_case_table_names=1

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[mysql]

default-character-set=utf8

2.6启动mysql,同时添加mysql自动启动

# /etc/rc.d/init.d/mysqld start

# chkconfig mysqld on

# chkconfig --list mysqld

2.7 修改mysql密码

# mysql -u root

/usr/bin/mysqladmin -u root password 123456

mysql> grant all on mysql.* to 'root'@'localhost' identified by 'mysql8895'

mysql> source /opt/MYSQL.sql 导入数据

mysql> exit

建立用户:

mysql> grant all on dcs.* to "ligang"@"%" identified by "dcsA99ligang";

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值