Redhat Linux上MySQL安裝

來源:互聯網
上載者:User

Redhat Linux上MySQL安裝

Linux平台上Mysql通常有三種安裝方式,即:
Rpm安裝
通用二進位包安裝
源碼安裝包
本文先就RPM安裝方式進行介紹,在此主要還是開源的社區版本介紹,首先下載
http://dev.mysql.com/downloads/mysql/
可以選擇針對不同平台的安裝包類型,目前最新的版本是5.7.11,RPM版本也有各種類型,瞭解了此,才能選擇合適的安裝包:

Package Name

Summary

mysql-community-server

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 -pmysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
這樣就完成了rpm安裝包的安裝,還是挺快的。

更多詳情見請繼續閱讀下一頁的精彩內容:

  • 1
  • 2
  • 下一頁
【內容導航】
第1頁:RPM安裝 第2頁:binary package安裝

相關文章

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.