您好,登錄后才能下訂單哦!
本篇內容主要講解“MySQL的rpm安裝方式”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“MySQL的rpm安裝方式”吧!
用于安裝MySQL的rpm包如下:
Table 2.6 RPM Packages for MySQL Community Edition
Package Name | Summary |
mysql-community-server | Database server and related tools 數據庫服務器和相關工具 |
mysql-community-client | MySQL client applications and tools MySQL客戶端應用程序和工具 |
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 |
Table 2.7 RPM Packages for the MySQL Enterprise Edition
Package Name | Summary |
mysql-commercial-server | Database server and related tools |
mysql-commercial-client | MySQL client applications and tools |
mysql-commercial-common | Common files for server and client libraries |
mysql-commercial-devel | Development header files and libraries for MySQL database client applications |
mysql-commercial-libs | Shared libraries for MySQL database client applications |
mysql-commercial-libs-compat | Shared compatibility libraries for previous MySQL installations |
mysql-commercial-embedded | MySQL embedded library |
mysql-commercial-embedded-devel | Development header files and libraries for MySQL as an embeddable library |
mysql-commercial-test | Test suite for the MySQL server |
rpm包的語法格式:
packagename-version-distribution-arch.rpm
The distribution and arch values indicate the Linux distribution and the processor type for which the package was built. See the table below for lists of the distribution identifiers:
Table 2.8 MySQL Linux RPM Package Distribution Identifiers
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 |
查看rpm包中所有文件(for example, mysql-community-server):
shell> rpm -qpl mysql-community-server-version-distribution-arch.rpm
本章剩余章節只適合從Oracle下載的包的安裝過程,不適用于MySQL庫的安裝。
包中存在一些依賴關系。如果你打算安裝好幾個包,你應該選擇下載tar格式的rpm包群,包群里包含了上述所有包,如此一來你便不用分別下載它們。
大多數情況下,你需要安裝mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and mysql-community-libs-compat這五個包來得到一個可用的、標準的MySQL系統。要執行這樣一個標準的、最小化的安裝,切換到這些包所在的文件夾的路徑,在除了Red Hat Enterprise Linux/Oracle Linux/CentOS 5平臺下執行如下命令:
shell> sudo yum install mysql-community-{server,client,common,libs}-*
Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).
對于Red Hat Enterprise Linux/Oracle Linux/CentOS 5平臺,有一個額外的包需要安裝:mysql-version-el5-arch.rpm,使用如下命令:
shell> sudo yum install mysql-community-{server,client,common,libs}-* mysql-5.*
盡管使用一個高級的包管理工具例如yum來安裝包會是極佳的選擇,但是仍有用戶喜歡直接使用rpm的命令rpm -Uvh來安裝,這種方式會增加失敗的風險,因為可能會遇到潛在的依賴包的問題。
To install only the client programs, you can skip mysql-community-server in your list of packages to install; issue the following command for platforms other than Red Hat Enterprise Linux/Oracle Linux/CentOS 5:
shell> sudo yum install mysql-community-{client,common,libs}-*
Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).
For Red Hat Enterprise Linux/Oracle Linux/CentOS 5 systems:
shell> sudo yum install mysql-community-{client,common,libs}-* mysql-5.*
A standard installation of MySQL using the RPM packages result in files and resources created under the system directories, shown in the following table.
MySQL安裝的默認布局如下:
Table 2.9 MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone
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的用戶和一個名為mysql的組。
Note
使用舊的安裝包來安裝原來的版本的MySQL可能會創建一個叫做/usr/my.cnf的配置文件。強烈建議您檢查該文件的內容并將有用的設置遷移到文件/etc/my.cnf中,然后移除/usr/my.cnf。
在安裝過程的最后,MySQL并不會自動啟動。對于Red Hat Enterprise Linux, Oracle Linux, CentOS, and Fedora systems,使用如下命令啟動MySQL:
shell> sudo service mysqld start
對于For SLES systems, 命令一樣,但是服務名不同:
shell> sudo service mysql start
如果操作系統啟用了systemd,那么標準的service命令例如stop,start,status以及restart都應該可以用來管理MySQL服務器的服務。mysqld服務默認開啟,并跟隨系統啟動。注意,有些事情在systemd平臺上會表現的不一致:例如,改變數據目錄的位置可能會產生問題。
At the initial start up of the server, the following happens, given that the data directory of the server is empty:
在服務器初始化啟動階段,會發生下列事情,前提是該服務器的數據目錄沒數據:
服務器初始化。
一個SSL證書和密鑰文件在數據目錄中產生。
validate_password plugin插件安裝并生效。
一個超級用戶帳號'root'@'localhost'創建。該超級用戶的密碼已設置并存儲在錯誤日志文件中。要找到它,RHEL, Oracle Linux, CentOS, and Fedora systems使用如下命令:
shell> sudo grep 'temporary password' /var/log/mysqld.log
Use the following command for SLES systems:
shell> sudo grep 'temporary password' /var/log/mysql/mysqld.log
接下來是利用剛生成的臨時密碼登錄數據庫并為該超級用戶帳號設置一個典型的密碼:
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Note
MySQL默認安裝 validate_password插件。該插件要求密碼包含至少一個大寫字母,一個小寫字母,一個數字以及一個特殊字符,同時密碼長度至少8位。
如果安裝過程中出現錯誤,你可以去錯誤日志文件/var/log/mysqld.log查找相關信息。對于某些Linux平臺,有必要提高對mysqld可用的文件描述符的限制。
到此,相信大家對“MySQL的rpm安裝方式”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。