mysql在linux上的安裝之一yum安裝,mysqllinuxyum安裝

來源:互聯網
上載者:User

mysql在linux上的安裝之一yum安裝,mysqllinuxyum安裝

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";


linux下用 yum安裝mysql後的安裝路徑在什地方?mysql的bin檔案時在什位置?

先用rpm -qa \*mysql\*看看你安裝了哪些包,然後用 rpm -ql xxxxxxx 去查看具體的包安裝位置
 
linux安裝 mysql?怎安裝?

在ubuntu或debian下,你需要運行:
apt-get install mysql5-server
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.