search
HomeDatabaseMysql TutorialMySQL安装方式的三大类型

我们大家都知道MySQL安装方式有三种,RPM的二进制包与实际应用源代码,我们本次所安装的相关系统平台为 redhat 5,以下就是具体方案的描述,希望在你今后的相关学习中会有所帮助。 一、使用RPM包进行MySQL安装 首先可以从安装光盘中或者到MySQL的网站上下载

我们大家都知道MySQL安装方式有三种,RPM的二进制包与实际应用源代码,我们本次所安装的相关系统平台为 redhat 5,以下就是具体方案的描述,希望在你今后的相关学习中会有所帮助。

一、使用RPM包进行MySQL安装

首先可以从安装光盘中或者到MySQL的网站上下载对应版本的rpm包如下:

<ol class="dp-xml">
<li class="alt">MySQL<span>-server-community-5.1.38-0.rhel5.i386.rpm   </span>
</li>
<li>MySQL<span>-client-community-5.1.38-0.rhel5.i386.rpm  </span>
</li>
</ol>

接着我们可以使用rpm命令进行MySQL安装:

<ol class="dp-xml">
<li class="alt"><span>rpm -ivh MySQL-server-community-5.1.38-0.rhel5.i386.rpm   </span></li>
<li>
<span>rpm -ivh </span>MySQL<span>-client-community-5.1.38-0.rhel5.i386.rpm  </span>
</li>
</ol>

二、安装二进制包

步骤如下:

1、用root登录系统,增加MySQL用户和组

<ol class="dp-xml">
<li class="alt"><span>groupadd MySQL   </span></li>
<li>
<span>useradd -g </span>MySQL<span> </span>MySQL<span>  </span>
</li>
</ol>

2、解压二进制包,假如二进制包放在/home/MySQL下,我们在解压后并增加一个符号链接

<ol class="dp-xml">
<li class="alt"><span>tar xvfz MySQL-5.1.38-linux-i686-glibc23.tar.gz   </span></li>
<li>
<span>ln -s </span>MySQL<span>-5.1.38-linux-i686-glibc23 </span>MySQL<span>  </span>
</li>
</ol>

3、在数据库目录下创建系统数据库的表,--user表示这些数据库和表的所有者为此用户

<ol class="dp-xml">
<li class="alt"><span>cd MySQL   </span></li>
<li>
<span>./scripts/</span>MySQL<span>_install_db </span><span class="attribute">--user</span><span>=</span>MySQL<span>  </span>
</li>
</ol>

4、设置目录权限,将data目录的所有者改为MySQL,其它目录的文件的所有者为root

<ol class="dp-xml">
<li class="alt"><span>chown -R root:MySQL .   </span></li>
<li>
<span>chown -R </span>MySQL<span>:</span>MySQL<span> data  </span>
</li>
</ol>

5、启动MySQL

<ol class="dp-xml"><li class="alt">./bin/MySQL<span>d_safe </span><span class="attribute">--user</span><span>=</span>MySQL<span> &  </span>
</li></ol>

三、源码MySQL安装

1、用root登录系统,增加MySQL用户和组

<ol class="dp-xml">
<li class="alt"><span>groupadd MySQL   </span></li>
<li>
<span>useradd -g </span>MySQL<span> </span>MySQL<span>  </span>
</li>
</ol>

2、解压源码包,并进入解压后的目录

<ol class="dp-xml">
<li class="alt"><span>tar xvfz MySQL-5.1.38.tar.gz   </span></li>
<li>
<span>cd </span>MySQL<span>-5.1.38  </span>
</li>
</ol>

3、用configure工具来编译源代码,这里我们可以使用很多的参数,具体可以用configure --help来查看,这里我们将MySQL安装到/usr/local/MySQL下

<ol class="dp-xml">
<li class="alt">./configuer --prefix=/usr/local/MySQL   </li>
<li><span>make   </span></li>
<li class="alt"><span>make install  </span></li>
</ol>

4、选择一个样例配置文件,并复制到/etc/下改名为my.cnf

<ol class="dp-xml"><li class="alt"><span><span>cp support-files/my-medium.cnf /etc/my.cnf  </span></span></li></ol>

5、在数据库目录下创建系统数据库的表,--user表示这些数据库和表的所有者为此用户

<ol class="dp-xml">
<li class="alt"><span>cd /usr/local/MySQL   </span></li>
<li>
<span>./bin/</span>MySQL<span>_install_db </span><span class="attribute">--user</span><span>=</span>MySQL<span>  </span>
</li>
</ol>

6、设置目录权限,将var目录的所有者更改为MySQL,其它目录和文件的所有者为root

<ol class="dp-xml">
<li class="alt"><span><span>chown -R root .   </span></span></li>
<li>
<span>chown -R </span>MySQL<span> var   </span>
</li>
<li class="alt">
<span>chgrp -R </span>MySQL<span> .  </span>
</li>
</ol>

7、启动MySQL

<ol class="dp-xml"><li class="alt">./bin/MySQL<span>d_safe </span><span class="attribute">--user</span><span>=</span>MySQL<span> &  </span>
</li></ol>

以上的相关内容就是对三种MySQL安装方式的介绍,望你能有所收获。


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.