安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx

上传人:b****3 文档编号:5459199 上传时间:2023-05-08 格式:DOCX 页数:20 大小:1.98MB
下载 相关 举报
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第1页
第1页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第2页
第2页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第3页
第3页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第4页
第4页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第5页
第5页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第6页
第6页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第7页
第7页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第8页
第8页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第9页
第9页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第10页
第10页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第11页
第11页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第12页
第12页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第13页
第13页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第14页
第14页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第15页
第15页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第16页
第16页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第17页
第17页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第18页
第18页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第19页
第19页 / 共20页
安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx_第20页
第20页 / 共20页
亲,该文档总共20页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx

《安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx》由会员分享,可在线阅读,更多相关《安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx(20页珍藏版)》请在冰点文库上搜索。

安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7.docx

安装配置MYSQLInstallandConfigureMySQLforPHPApplicationsonIIS7

 

InstallandConfigureMySQLforPHPApplicationsonIIS7

Introduction

WhileMicrosoft®SQLServer®2008istherecommendeddatabasetousewhenhostingPHPapplicationsonanInternetInformationServices7(IIS7)andaboveWebserver,youcanalsouseMySQLasthedatabase.Currently,manypopularPHPapplicationsuseMySQLServerfordatastorage.UsingMySQLrequireshostingproviderstoincludeMySQLdatabasesupportwiththehostingpackages.

MySQLcannotcurrentlybeinstalledwiththeMicrosoft®WebPlatformInstaller(WebPI).ThisarticleprovidesguidanceforinstallingMySQLmanually.

InstallMySQLServeronWindowsServer2008orWindowsServer2008R2

ItisrecommendedthatyouinstallMySQLonadedicatedserverratherthaninstallingMySQLonthesameserverthatisrunningIIS.TheseparationofdatabaseserverandWebservermakesoverallinstallationmoresecureandmanageableandavoidsresourcecontentionsbetweenthedatabaseandWebserverprocesses.

1.DownloadMySQLCommunityServer.

a.WerecommenddownloadingWindows®Installer.

2.StartWindowsInstaller,orextractallthefilesfromthearchive,andthenstartSetup.exe.

3.YoucanuseaTypicalSetuporcustomizetheinstallationtosuityourneeds.

4.Oncetheinstallationwizardiscompleted,itisrecommendedthatyouleavetheConfiguretheMySQLServernowcheckboxselected.

ConfigureaMySQLInstance

1.RuntheMySQLServerInstanceConfigurationWizard,andthenchoosetheconfigurationsoptionsthatmostcloselymatchyourenvironment.

Formoreinformation,seetheServerInstanceConfigurationWizard.

Bestpracticerecommendationsareasfollows:

a.ClickNextintheInstanceConfigurationWizard.

b.SelectDetailedConfiguration,andthenclickNext.

c.Selectaservertypethatbestsuitsyourenvironment.ItisrecommendedtosetupaseparateMySQLserver;whenpromptedtoselectaservertype,selectDedicatedMySQLServerMachine,andthenclickNext.

d.Selectadatabaseoption,andthenclickNext.

SelecteithertheMultifunctionalDatabaseorTransactionalDatabaseOnlyoptionsifyouareusingtheInnoDBstorageengineorthehigh-speedMyISAMstorageengine(forexample,iftheWebapplicationsonyourserverrequiremulti-statementtransactions,advancedisolationlevelsandrow-levellocking,foreignkeyconstraints,oratomic,consistent,isolated,anddurable[ACID]features).TheseoptionsprovidesfullyACIDtransactionalcapabilities,butatthecostofmoreaggressiveusageofdiskspaceandmemory.

Otherwise,usetheNon-TransactionalDatabaseOnlyoption,whichisoptimizedforhigh-performanceSELECToperations.Ithaslowoverhead,intermsofmemoryusageanddiskutilization,butatthecostofnotsupportingtransactions.

e.Choosetheoptionthatsetsthenumberofconcurrentconnectionsyouneed.

Note:

Connectionsrequirememory;ifthenumberyouchooseistoobig,yourservermaynothaveenoughmemory.

f.Youmayadjustnetworkingsettingstosuityourenvironmentoracceptdefaults,andthenclickNext.

g.Selectthedefaultcharactersetthatbestsuitsyou,andthenclickNext.

h.WerecommendenablingbothWindowsoptionshere.Selectbothcheckboxes,andthenclickNext.

i.Typethepasswordyouwanttousefortherootaccount,andthenclickNext.

j.ClickExecutetoapplyyoursettings.

k.ClickFinishtoclosethewizard.

2.ForPHPtoworkwithMySQL,itisnecessarytoperformthefollowingmodificationstothePhp.inifile:

a.Confirmthattheextension_dirpointstothefolderwhereallPHPloadableextensionsarelocated,frequentlyintheExtfolder(forexample,extension_dir=”.\ext”).

b.EnabledynamicextensionforMySQLbyuncommentingthecorrespondinglinefortheMySQLextension:

extension=php_mysql.dll

extension=php_mysqli.dll?

c.SaveandclosethePhp.inifile.

SecureMySQL

1.Removetheanonymousdatabaseaccount(ifitexists).OpentheMySQLcommandpromptbyclickingStart->AllPrograms->MySQL->MySQLServer5.1->MySQLCommandLineClient:

2.Enterthepasswordfortherootaccount.

3.OnceloggedontoMySQL,usethefollowingsequenceofcommands:

mysql>usemysql;

Databasechanged

mysql>DELETEFROMuserWHEREuser='';

QueryOK,2rowsaffected(0.03sec)

mysql>FLUSHPRIVILEGES;

QueryOK,0rowsaffected(0.05sec)

4.Next,restricttherootaccounttologononlyfromlocalhost.OpenaMySQLcommandprompt,andusethefollowingsequenceofcommands:

mysql>usemysql;

Databasechanged

mysql>DELETEFROMuserWHEREuser='root'ANDhost='%';

QueryOK,2rowsaffected(0.03sec)

mysql>FLUSHPRIVILEGES;

QueryOK,0rowsaffected(0.05sec)

5.Changethenameoftherootuserwiththefollowingsequenceofcommandsfromthecommandprompt:

mysql>USEmysql;

Databasechanged

mysql>UPDATEuserSETuser='johndoe'WHEREuser='root';

QueryOK,1rowaffected(0.19sec)

Rowsmatched:

1Changed:

1Warnings:

0

mysql>FLUSHPRIVILEGES;

QueryOK,0rowsaffected(0.23sec)

ProvisiontheUserandDatabase

1.Toprovisionanewuser,typethefollowingcommandfromtheMySQLcommandprompt:

mysql>CREATEUSER‘some_username’IDENTIFIEDBY‘some_password’;

QueryOK,0rowsaffected(0.00sec)

2.ThenewlycreateduserdoesnothaveanyprivilegesontheMySQLserverbydefault.Tocreateanewdatabase,typethefollowingcommand:

mysql>CREATEDATABASEIFNOTEXISTSsome_database_name;

QueryOK,1rowaffected(0.00sec)

3.Tograntaccesstothisdatabaseforaparticularuser,typethefollowingcommand:

mysql>GRANTALTER,

->ALTERROUTINE,

->CREATE,

->CREATEROUTINE,

->CREATETEMPORARYTABLES,

->CREATEVIEW,

->DELETE,

->DROP,

->EXECUTE,

->INDEX,

->INSERT,

->LOCKTABLES,

->SELECT,

->UPDATE,

->SHOWVIEW

ONsome_database_name.*TO'some_username';

ConfigurePHPtoAccessMySQL

1.Openthec:

\php\php.inifilewithyourfavoritetexteditor.

2.Uncomment(反注释此行.表示此行不要被注释掉,需要参与编译)thefollowinglinesbyremovingthesemicolon(分号):

extension=php_mysqli.dll

extension=php_mbstring.dll

extension=php_mcrypt.dll

3.RestarttheIISservicebyclickingonStart,selectingtheSearchField,typingiisreset,andthenpressingENTER.

4.Ifallwentwell,youshouldseethemysqlisectiononthePHPinformationpagecreatedearlier(http:

//localhost/phpinfo.php).

Figure1:

ThemysqlisectiononthePHPinformationpage

测试

php

$link=mysql_connect("localhost","root","123456qaz");

if(!

$link)//若连接失败,则显示相应信息并终止程序运行

{

echo"连接失败!


";

echo"错误编号:

".mysql_errno()."
";

echo"错误信息:

".mysql_error()."
";

die();//终止程序运行

}

echo"连接成功!


";

?

>

$link=mysql_connect("localhost","root","123456"),以上密码有误则连接失败

$link=mysql_connect("localhost","root","123456qaz")密码正确后则连接成功

BestPracticesforMySQL

∙EnableTCP/IPNetworking

Thisisthedefault.KeeptheTCPportthatMySQLusestolistenat3306.IfthedatabasewillberunningonaseparatesystemfromtheWebserver,selecttheAddfirewallexceptionforthisportcheckbox.

∙IncludeBinDirectoryinWindowsPATH

ThismakestheMySQLutilitiesavailablefromthecommandpromptorfromWindowsPowerShell™.

∙CreateanAnonymousAccount

Thedefaultistokeepthisdisabled.Addinganonymoususersupportmaycreateasecurityriskforthedatabase;additionally,enablinganonymoususerscausestheGRANTstatementsusedtosetupdatabasetobeunreliable.

LinksforFurtherInformation

MySQLServerWebsite.

UsingtheMySQLInstallationWizard.

InstallingMySQLfromaNoinstallZipArchive.

MySQLWindowsInstallation.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2