在UNIX上安裝MySQL_MySQL
Jun 01, 2016 pm 01:54 PMunix安裝
可得到幾種版本的MySQL分發(fā)包。當(dāng)前穩(wěn)定的發(fā)行版有3.22 版本系列。當(dāng)前正在開(kāi)發(fā)的版本為3.23 系列。一般,應(yīng)該使用系列中最高編號(hào)的版本。
??? MySQL分發(fā)包可以以二進(jìn)制代碼、RPM 和源代碼的格式得到。二進(jìn)制代碼和RPM 分發(fā)包容易安裝,但必須接受建立在分發(fā)包內(nèi)的安裝設(shè)計(jì)和缺省配置。源代碼分發(fā)包安裝很困難,因?yàn)楸仨殞?duì)軟件進(jìn)行編譯,但可對(duì)參數(shù)進(jìn)行更多的控制。例如,可以只編譯客戶機(jī)程序的分
發(fā)包,而不用管服務(wù)器,可以更改安裝軟件的目標(biāo)位置等。
??? 分發(fā)包含有下列一個(gè)或多個(gè)組件:
??? mysqld 服務(wù)器
??? 客戶機(jī)程序(mysql、mysqladmin 等)以及客戶機(jī)編程支持環(huán)境(庫(kù)和頭文件)
??? 文檔
??? 標(biāo)準(zhǔn)數(shù)據(jù)庫(kù)
??? 語(yǔ)言支持環(huán)境
??? 源程序和二進(jìn)制代碼分發(fā)包含有上述所有內(nèi)容。每個(gè)RPM 文件只包含其中一些內(nèi)容,因此為了得到所需的東西,可能需要安裝多個(gè)R P M。
??? 如果打算連接到其他機(jī)器上運(yùn)行的服務(wù)器,則不需要安裝服務(wù)器,但應(yīng)該安裝客戶機(jī)軟件:
??? 如果不運(yùn)行服務(wù)器,那么只需要客戶機(jī),以便能夠連接到其他機(jī)器的服務(wù)器上。
??? 如果您確實(shí)運(yùn)行一個(gè)服務(wù)器,將希望能夠從該服務(wù)器的主機(jī)對(duì)此服務(wù)器進(jìn)行連接,而不是在其他具有客戶機(jī)軟件的機(jī)器上登錄,然后再來(lái)測(cè)試您的服務(wù)器。
MySQL安裝綜述
??? 在UNIX 上安裝MySQL涉及下列步驟:
??? 1) 創(chuàng)建一個(gè)用戶的UNIX 賬號(hào)和服務(wù)器將操縱的組(如果正在安裝服務(wù)器)。
??? 2) 獲得和打開(kāi)想安裝的分發(fā)包。如果使用的是源代碼分發(fā)包,編譯并安裝它。
??? 3) 運(yùn)行mysql_install_db 腳本來(lái)初始化數(shù)據(jù)目錄和權(quán)限表(僅允許第一次安裝)。
??? 4) 啟動(dòng)服務(wù)器。
??? 5) 參閱第11章,熟悉一般的管理過(guò)程。特別應(yīng)該閱讀服務(wù)器設(shè)置和關(guān)閉以及作為無(wú)特權(quán)用戶運(yùn)行服務(wù)器的段落。
創(chuàng)建MySQL用戶賬號(hào)
??? 如果只需要運(yùn)行MySQL客戶機(jī)軟件,而不打算運(yùn)行MySQL服務(wù)器,可以跳過(guò)這一節(jié)。
??? MySQL服務(wù)器可作為系統(tǒng)上的任何UNIX 用戶運(yùn)行,但出于安全和保密的原因,最好是不以root 身份運(yùn)行服務(wù)器。建議創(chuàng)建一個(gè)獨(dú)立的賬號(hào)用于MySQL管理,并以該用戶運(yùn)行服務(wù)器。這樣,可作為該用戶登錄,并在進(jìn)行維護(hù)和故障排除的目錄中具有完全的權(quán)限。創(chuàng)建
用戶賬號(hào)的過(guò)程隨系統(tǒng)的不同而不同。詳細(xì)內(nèi)容可參閱相應(yīng)的文獻(xiàn)。
??? 本書(shū)將mysqla d m和mysqlg r p分別用于UNIX 用戶和此賬號(hào)的組名。如果打算安裝MySQL只為自己使用,可以自己運(yùn)行它,那么在本書(shū)中任何地方出現(xiàn)的mysqladm 和mysqlg r p都可換成您自己的登錄名和組名。如果從RPM 文件進(jìn)行安裝,隨RPM 的安裝過(guò)程會(huì)自動(dòng)建立一個(gè)名為mysql的用戶。在這樣的情況下,可以將mysql替換成mysqla d m。
??? 使用獨(dú)立、無(wú)特權(quán)帳戶而不是運(yùn)行MySQL的r o o t,其優(yōu)點(diǎn)為:
??? 如果不以root 運(yùn)行MySQL,任何人都不能利用此服務(wù)器的安全漏洞獲得root 訪問(wèn)。
??? 無(wú)特權(quán)的用戶執(zhí)行MySQL管理任務(wù)比用root 執(zhí)行更為安全。
??? 服務(wù)器將創(chuàng)建mysqladm 而非root 擁有的文件。r o o t在系統(tǒng)上擁有的文件越少越好。
??? 將MySQL的活動(dòng)分隔在它自己的賬號(hào)中可以在概念上更為清晰,并且更容易看出系統(tǒng)上什么東西與MySQL相關(guān)。例如,在保存core 文件的目錄中,有MySQL用戶mysqladm 的一個(gè)獨(dú)立文件。否則MySQL的corn 作業(yè)將位于root 的文件中,將會(huì)和其他東西一起作為root 周期性的執(zhí)行。
獲得和安裝MySQL分發(fā)包
??? 在下面的說(shuō)明中,我們用版本代表MySQL的版本號(hào),用平臺(tái)代表在其上進(jìn)行安裝的平臺(tái)名。它們也用在分發(fā)包文件名中,以便容易標(biāo)識(shí)分發(fā)包,并將各個(gè)分發(fā)包區(qū)分開(kāi)來(lái)。版本號(hào)是一些類(lèi)似于3.22.26 或3.23.4-alpha 這樣的東西,平臺(tái)名是類(lèi)似于sgi-irix6.3-mips 或d e c -osf4-0b-alpha 這樣的東西。
??? 1. 安裝二進(jìn)制代碼分發(fā)包
??? 二進(jìn)制代碼分發(fā)包文件具有諸如m s q l -ver s i o n - p l a t f o r m. t a r.gz 這樣的名字。獲得理想版本和平臺(tái)的分發(fā)包文件并將它放入指定的安裝MySQL目錄,如/ us r / l o c a l。
??? 用下面的任意一條命令打開(kāi)分發(fā)包(如果tar 版本不支持非壓縮分發(fā)包的z 選項(xiàng),應(yīng)該使用第二條命令):
??? % tar zxf mysql-version-platform.tar.gz
??? % gunzip ??? 打開(kāi)分發(fā)包創(chuàng)建包含分發(fā)包內(nèi)容的目錄mysql-ver s i o n - p l a t f o r m。為了更容易引用這個(gè)目錄,可創(chuàng)建一個(gè)符號(hào)連接:
??? % ln -s mysql-version-platorm mysql??? 現(xiàn)在,如果在/usr/local 目錄下安裝MySQL,可引用的安裝目錄為/ us r / l o c a l / mysql。
??? 如果只準(zhǔn)備使用分發(fā)包所提供的客戶機(jī)支持環(huán)境并且不運(yùn)行服務(wù)器,則安裝結(jié)束。如果是第一次安裝MySQL,可參閱A . 3 . 4節(jié)“初始化數(shù)據(jù)目錄和權(quán)限表”。如果是對(duì)已有安裝進(jìn)行更新,可參閱A . 3 . 5節(jié)“啟動(dòng)服務(wù)器”。
??? 2. 安裝RPM 分發(fā)包
??? RPM 文件可用于Linux 系統(tǒng)上的MySQL安裝。它們具有如下的文件名:
??? MySQL-ver s i o n - p l a t f o r m.rpm 服務(wù)器軟件。
??? MySQL- c l i e n t. ver s i o n - p l a t f o r m.rpm 客戶機(jī)程序。
??? MySQL- d e v e l .ver s i o n - p l a t f o r m.rpm 編寫(xiě)客戶機(jī)程序的開(kāi)發(fā)支持環(huán)境(客戶機(jī)庫(kù)和頭文件)。如果想使用或編寫(xiě)訪問(wèn)MySQL數(shù)據(jù)庫(kù)的Perl DBI 腳本,則需要用到它。
??? MySQL- b e n c h. ver s i o n - p l a t f o r m.rpm 標(biāo)準(zhǔn)和測(cè)試。需要Perl 和Msql-Mysql-modules 模塊??稍趙 w w.mysql.com 上得到Mysql-Mysql-modules 的一個(gè)RPM 文件。
??? MySQL-ver s i o n .src.rpm 服務(wù)器、客戶機(jī)、標(biāo)準(zhǔn)和測(cè)試的源代碼。
??? 如果從RPM 安裝,不需要特定的目錄,因?yàn)镽PM 文件含有指定將所包含的文件安裝在何處的信息。對(duì)任何RPM 文件r p m _ f i l e,可用下列命令知道其內(nèi)容將安裝在何處:
??? % rpm -qpl rpm_file
??? 為了安裝一個(gè)RPM 文件,使用下列命令:
??? % rpm -i rpm_file
??? MySQL的各組成部分被劃分為不同的RPM 文件,因此可能需要安裝不止一個(gè)R P M。為了安裝客戶機(jī)支持環(huán)境,可使用下列命令:
??? % rpm -i MySQL-client-version-platform.rpm
??? 安裝服務(wù)器支持環(huán)境,使用下列命令:
??? % rpm -i MySQL-version-platform.rpm
??? 如果打算使用客戶機(jī)編程支持環(huán)境編寫(xiě)自己的程序,應(yīng)該安裝供開(kāi)發(fā)用的RPM 文件:
??? % rpm -i MySQL-devel-version-platform.rpm
??? 如果打算使用分發(fā)包提供的客戶機(jī)支持環(huán)境,而且不準(zhǔn)備使用服務(wù)器, MySQL的安裝就結(jié)束了。如果是第一次安裝MySQL,可參閱A . 3 . 4節(jié)“初始化數(shù)據(jù)目錄和權(quán)限表”。如果是對(duì)現(xiàn)有安裝進(jìn)行更新,可參閱A . 3 . 5節(jié)“啟動(dòng)服務(wù)器”。
??? 如果想從源代碼RPM 文件進(jìn)行安裝,用下面的命令就可以了:
??? % rpm --recompile MySQL-version.src.rpm
??? 3. 安裝源代碼分發(fā)包
??? 源代碼分發(fā)包具有如mysql- ver s i o n . t a r.gz 這樣的名稱,其中version 為MySQL的版本號(hào)。選擇想要將分發(fā)包放在其下的目錄,并進(jìn)入該目錄。獲得分發(fā)包文件并用下列命令之一打開(kāi)它(如果tar 版本不支持非壓縮分發(fā)包的z 選項(xiàng),應(yīng)該使用第二條命令):
??? % tar zxf mysql-version.tar.gz
??? % gunzip ??? 打開(kāi)分發(fā)包創(chuàng)建包含分發(fā)包內(nèi)容的目錄mysql- ver s i o n,并進(jìn)入此目錄。
??? % cd mysql-version
??? 在安裝以前,需要配置和編譯此分發(fā)包。如果各步驟失敗,應(yīng)該參閱MySQL參考指南的“安裝MySQL”一章,應(yīng)該特別注意它所包含的有關(guān)各種機(jī)器專(zhuān)有的系統(tǒng)說(shuō)明。
??? 使用configure 命令配置分發(fā)包:
??? % ./configure
??? 可以為configure 指定選項(xiàng)。為了得到可用的選項(xiàng)表,執(zhí)行下列命令:
??? % ./configu

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head

As a fast and efficient programming language, Go language is widely popular in the field of back-end development. However, few people associate Go language with front-end development. In fact, using Go language for front-end development can not only improve efficiency, but also bring new horizons to developers. This article will explore the possibility of using the Go language for front-end development and provide specific code examples to help readers better understand this area. In traditional front-end development, JavaScript, HTML, and CSS are often used to build user interfaces

Summary of the five most popular Go language libraries: essential tools for development, requiring specific code examples. Since its birth, the Go language has received widespread attention and application. As an emerging efficient and concise programming language, Go's rapid development is inseparable from the support of rich open source libraries. This article will introduce the five most popular Go language libraries. These libraries play a vital role in Go development and provide developers with powerful functions and a convenient development experience. At the same time, in order to better understand the uses and functions of these libraries, we will explain them with specific code examples.

Android development is a busy and exciting job, and choosing a suitable Linux distribution for development is particularly important. Among the many Linux distributions, which one is most suitable for Android development? This article will explore this issue from several aspects and give specific code examples. First, let’s take a look at several currently popular Linux distributions: Ubuntu, Fedora, Debian, CentOS, etc. They all have their own advantages and characteristics.

VSCode is a powerful, flexible, and easy-to-extend open source code editor that is widely favored by developers. It supports many programming languages ??and frameworks to meet different project needs. However, the advantages of VSCode may be different for different frameworks. This article will discuss the applicability of VSCode in the development of different frameworks and provide specific code examples. 1.ReactReact is a popular JavaScript library used for building user interfaces. When developing projects using React,

Title: Easily learn to convert hexadecimal to binary in Go language. Specific code examples are required. In computer programming, conversion operations between different base numbers are often involved. Among them, conversion between hexadecimal and binary is relatively common. In the Go language, we can achieve hexadecimal to binary conversion through some simple code examples. Let us learn together. First, let's take a look at the representation methods of hexadecimal and binary. Hexadecimal is a method of representing numbers, using 0-9 and A-F to represent 1
