Redhat Linux上mysql安裝-RPM安裝

Linux平臺上Mysql一般有三種安裝方式,即:html

Rpm安裝mysql

通用二制包安裝sql

安裝包shell

本文先就RPM安裝方式介紹,在此主要仍是開源的社區版本介紹,首先下載數據庫

http://dev.mysql.com/downloads/mysql/服務器

能夠選擇針對不一樣平臺的安裝包類型,目前最新的版本是5.7.11,RPM版本也有各類類型,瞭解了此,才能選擇合適的安裝包:app

Package Nameide

Summaryui

mysql-community-serverspa

Database server and  related tools

mysql-community-client

MySQL client  applications and tools

mysql-community-common

Common files for  server and client libraries

mysql-community-devel

Development header  files and libraries for MySQL database client applications

mysql-community-libs

Shared libraries  for MySQL database client applications

mysql-community-libs-compat

Shared  compatibility libraries for previous MySQL installations

mysql-community-embedded

MySQL embedded  library

mysql-community-embedded-devel

Development header  files and libraries for MySQL as an embeddable library

mysql-community-test

Test suite for the  MySQL server

 

其具體名稱結構以下:

packagename-version-distribution-arch.rpm

version就不用說啦,其實就是數據庫的版本,distribution和arch表示的是爲什麼種LINUX類型和CPU平臺構建的安裝包,具體的分發標誌以下:

distribution Value

Intended Use

el5, el6, el7

Red  Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7

fc22, fc23

Fedora  22 or 23

sles12

SUSE  Linux Enterprise Server 12

 

好比:mysql-community-server-5.7.11-1.el7.x86_64.rpm,就是RedHat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit),上的RPMPackage
MySQL Server
安裝包

 

安裝呢就很簡單:

shell> rpm -qpl mysql-community-server-version-distribution-arch.rpm

能夠看到RPM包安裝起來簡單,比較適合初學者,可是須要根據具體需求下載合適的安裝包如server和client須要單獨分開安裝,具體參見上表;

另外就是安裝路徑不靈活,默認路徑不可修改,因此一臺server上只能安裝一個server,具體路徑以下:

Files or Resources

Location

Client  programs and scripts

/usr/bin

mysqld  server

/usr/sbin

Configuration  file

/etc/my.cnf

Data  directory

/var/lib/mysql

Error  log file

For  RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log

For  SLES: /var/log/mysql/mysqld.log

Value  of secure_file_priv

/var/lib/mysql-files

System  V init script

For  RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld

For  SLES: /etc/init.d/mysql

Systemd  service

For  RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld

For  SLES: mysql

Pid  file

/var/run/mysql/mysqld.pid

Socket

/var/lib/mysql/mysql.sock

Keyring  directory

/var/lib/mysql-keyring

Unix  manual pages

/usr/share/man

Include  (header) files

/usr/include/mysql

Libraries

/usr/lib/mysql

Miscellaneous  support files (for example, error messages, and character set files)

/usr/share/mysql

 

安裝完畢後MYSQL並非自動啓動,而須要手工啓動:

shell> service mysqld start

 

初始化啓動服務器後,超級帳戶’root’@localhost’被建立,用戶密碼被生產放在了error log文件中,採用
shell> grep 'temporary password' /var/log/mysqld.log

能夠找到,登錄修改密碼便可:

shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

 

這樣就完成了rpm安裝包的安裝,仍是挺快的。

相關文章
相關標籤/搜索