您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > mysql在linux64位下安装步骤完整版
一.下载说明前期的一些准备说明,参考:MySQL发展史不同版本说明分为CommunityServer和EnterpriseEdition。其中CommunityServer可以直接从mysql的官网下载。EnterpriceEdition只能从Oracleedelivery上下载,不过Edelivery现在已经屏蔽了中国的IP,如果国内的用户一般不能从edelivery上下载,需要翻墙出去才能下载。1.1官方文档上有关MySQL安装文件类型说明::(1)Installingfromagenericbinarypackagein.tar.gzformat.SeeSection2.2,“InstallingMySQLfromGenericBinariesonUnix/Linux”formoreinformation.(2)ExtractingandcompilingMySQLfromasourcedistribution.Fordetailedinstructions,seeSection2.9,“InstallingMySQLfromSource”.(3)Installingusingapre-compiledRPMpackage.FormoreinformationonusingtheRPMsolution,seeSection2.5.1,“InstallingMySQLfromRPMPackagesonLinux”.--这里讲了3种方式来安装MySQL数据库,我这里用最简单的RPM包来安装。Asanalternative,youcanusethenativepackagemanagerwithinyourLinuxdistributiontoautomaticallydownloadandinstallMySQLforyou.NativepackageinstallationscantakeofthedownloadanddependenciesrequiredtorunMySQL,buttheMySQLversionwilloftenbesomewaybehindthecurrentlyavailablerelease.Youwillalsonormallybeunabletoinstalldevelopmentalreleases,asthesearenotusuallymadeavailableinthenativerepository.Formoreinformationonusingthenativepackageinstallers,seeSection2.5.2,“InstallingMySQLonLinuxusingNativePackageManager”.NoteFormanyLinuxinstallations,youwillwanttosetupMySQLtobestartedautomaticallywhenyourmachinestarts.Manyofthenativepackageinstallationsperformthisoperationforyou,butforsource,binaryandRPMsolutionsyoumayneedtosetthisupseparately.Therequiredscript,mysql.server,canbefoundinthesupport-filesdirectoryundertheMySQLinstallationdirectoryorinaMySQLsourcetree.Youcaninstallitas/etc/init.d/mysqlforautomaticMySQLstartupandshutdown.SeeSection2.10.1.2,“StartingandStoppingMySQLAutomatically”.--这里要注意一个问题,就是设置MySQL的自启动。如果使用nativepackage来安装,会自动设置为自启动,如果使用其他的方式,如source,binary和RPM,就需要单独的来设置自启动。1.2下载安装包CommunityServer下载地址:这里只需要下载linux64位下mysql5.5.33的服务端和客户端安装包:MySQL-server-5.5.33-1.linux2.6.x86_64.rpmMySQL-client-5.5.33-1.linux2.6.x86_64.rpm二.安装MySQL2.1安装说明(1)MySQL的安装包有很多个,作用也不同,在大多数情况下,只需要安装MySQL-server和MySQL-client,其他的包根据需要来安装。(2)TheserverRPMplacesdataunderthe/var/lib/mysqldirectory.TheRPMalsocreatesaloginaccountforausernamedmysql(ifonedoesnotexist)touseforrunningtheMySQLserver,andcreatestheappropriateentriesin/etc/init.d/tostarttheserverautomaticallyatboottime.(Thismeansthatifyouhaveperformedapreviousinstallationandhavemadechangestoitsstartupscript,youmaywanttomakeacopyofthescriptsothatyoudonotloseitwhenyouinstallanewerRPM.)(3)DuringRPMinstallation,ausernamedmysqlandagroupnamedmysqlarecreatedonthesystem.Thisisdoneusingtheuseradd,groupadd,andusermodcommands.Thosecommandsrequireappropriateadministrativeprivileges,whichisrequiredforlocallymanagedusersandgroups(aslistedinthe/etc/passwdand/etc/groupfiles)bytheRPMinstallationprocessbeingrunbyroot.--在MySQL安装时,会创建mysql用户和mysql组。(4)MySQL的相关目录说明/usr/bin:Clientprogramsandscripts--mysqladminmysqldump等命令/usr/sbin:Themysqldserver/var/lib/mysql:Logfiles,databases--这个目录就是数据库的目录/usr/share/info:ManualinInfoformat/usr/share/man:Unixmanualpages/usr/include/mysql:Include(header)files/usr/lib/mysql:Libraries/usr/share/mysql:Miscellaneoussupportfiles,includingerrormessages,charactersetfiles,sampleconfigurationfiles,SQLfordatabaseinstallation--mysql.server命令及配置文件/usr/share/sql-bench:Benchmarks/etc/rc.d/init.d/:启动脚本文件mysql的目录2.2安装将下载的安装包拷贝至/home/mysql目录下:--安装Server端:[root@localhostmysql]#rpm-ivhMySQL-server-5.5.33-1.linux2.6.x86_64.rpmPreparing...###########################################[100%]1:MySQL-server###########################################[100%]PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER!Todoso,starttheserver,thenissuethefollowingcommands:/usr/bin/mysqladmin-urootpassword'new-password'/usr/bin/mysqladmin-uroot-hrac2password'new-password'Alternativelyyoucanrun:/usr/bin/mysql_secure_installationwhichwillalsogiveyoutheoptionofremovingthetestdatabasesandanonymoususercreatedbydefault.Thisisstronglyrecommendedforproductionservers.Seethemanualformoreinstructions.Pleasereportanyproblemswiththe/usr/bin/mysqlbugscript![root@rac2software]#---安装客户端[root@localhostmysql]#rpm-ivhMySQL-client-5.5.33-1.linux2.6.x86_64.rpmPreparing...###########################################[100%]1:MySQL-client###########################################[100%]2.3安装完成后参数设置2.3.1修改密码--连接MySQL报错:[root@localhostmysql]#mysqlERROR2002(HY000):Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)--启动MySQL后,在连正常:[root@localhost~]#/etc/init.d/mysqlstartStartingMySQL...[OK][root@localhost~]##mysqlWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis1Serverversion:5.5.15MySQLCommunityServer(GPL)Copyright(c)2000,2010,Oracleand/oritsaffiliates.Allrightsreserved.Oracleisaregisteredtradema
本文标题:mysql在linux64位下安装步骤完整版
链接地址:https://www.777doc.com/doc-3904864 .html