本篇內(nèi)容主要講解“MySQL的rpm安裝方式”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“MySQL的rpm安裝方式”吧!

用于安裝MySQL的rpm包如下:
Table 2.6 RPM Packages for MySQL Community Edition
| Package Name | Summary |
| mysql-community-server | Database server and related tools 數(shù)據(jù)庫服務(wù)器和相關(guān)工具 |
| mysql-community-client | MySQL client applications and tools MySQL客戶端應(yīng)用程序和工具 |
| mysql-community-common | Common files for server and client libraries 服務(wù)器和客戶端庫庫的通用文件 |
| 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
本章剩余章節(jié)只適合從Oracle下載的包的安裝過程,不適用于MySQL庫的安裝。
包中存在一些依賴關(guān)系。如果你打算安裝好幾個包,你應(yīng)該選擇下載tar格式的rpm包群,包群里包含了上述所有包,如此一來你便不用分別下載它們。
大多數(shù)情況下,你需要安裝mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and mysql-community-libs-compat這五個包來得到一個可用的、標(biāo)準(zhǔn)的MySQL系統(tǒng)。要執(zhí)行這樣一個標(biāo)準(zhǔn)的、最小化的安裝,切換到這些包所在的文件夾的路徑,在除了Red Hat Enterprise Linux/Oracle Linux/CentOS 5平臺下執(zhí)行如下命令:
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來安裝,這種方式會增加失敗的風(fēng)險,因為可能會遇到潛在的依賴包的問題。
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安裝的默認(rèn)布局如下:
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 |
安裝同時會在操作系統(tǒng)上創(chuàng)建一個名為mysql的用戶和一個名為mysql的組。
Note
使用舊的安裝包來安裝原來的版本的MySQL可能會創(chuàng)建一個叫做/usr/my.cnf的配置文件。強(qiáng)烈建議您檢查該文件的內(nèi)容并將有用的設(shè)置遷移到文件/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, 命令一樣,但是服務(wù)名不同:
shell> sudo service mysql start
如果操作系統(tǒng)啟用了systemd,那么標(biāo)準(zhǔn)的service命令例如stop,start,status以及restart都應(yīng)該可以用來管理MySQL服務(wù)器的服務(wù)。mysqld服務(wù)默認(rèn)開啟,并跟隨系統(tǒng)啟動。注意,有些事情在systemd平臺上會表現(xiàn)的不一致:例如,改變數(shù)據(jù)目錄的位置可能會產(chǎn)生問題。
At the initial start up of the server, the following happens, given that the data directory of the server is empty:
在服務(wù)器初始化啟動階段,會發(fā)生下列事情,前提是該服務(wù)器的數(shù)據(jù)目錄沒數(shù)據(jù):
服務(wù)器初始化。
一個SSL證書和密鑰文件在數(shù)據(jù)目錄中產(chǎn)生。
validate_password plugin插件安裝并生效。
一個超級用戶帳號'root'@'localhost'創(chuàng)建。該超級用戶的密碼已設(shè)置并存儲在錯誤日志文件中。要找到它,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
接下來是利用剛生成的臨時密碼登錄數(shù)據(jù)庫并為該超級用戶帳號設(shè)置一個典型的密碼:
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Note
MySQL默認(rèn)安裝 validate_password插件。該插件要求密碼包含至少一個大寫字母,一個小寫字母,一個數(shù)字以及一個特殊字符,同時密碼長度至少8位。
如果安裝過程中出現(xiàn)錯誤,你可以去錯誤日志文件/var/log/mysqld.log查找相關(guān)信息。對于某些Linux平臺,有必要提高對mysqld可用的文件描述符的限制。
到此,相信大家對“MySQL的rpm安裝方式”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
網(wǎng)站欄目:MySQL的rpm安裝方式-創(chuàng)新互聯(lián)
標(biāo)題URL:http://www.yijiale78.com/article24/cdpije.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、小程序開發(fā)、網(wǎng)站營銷、網(wǎng)站制作、響應(yīng)式網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容