Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
从官网下载mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
创建mysql用户
[root@Masterhome]#useraddmysql [root@Masterdata]#echo'mysql'|passwd--stdinmysql
更改用户mysql的密码。
passwd:所有的身份验证令牌已经成功更新。
创建mysql用户的原因
不用mysql用户会出现一下错误,尝试了很多次,添加mysql用户安装成功
*当然很多时候我们已经创建好别的用户,来完成日常的操作如果不创建mysql用户,修改mysql/bin目录下的mysqld_safe文件;//亲测成功
具体步骤:
[root@Masterbin]#vimmysqld_safe user='mysql'修改为user='hadoop'//自己的用户后边步骤基本相同* [root@Slave1data]#servicemysqlstart StartingMySQL......ERROR!TheserverquitwithoutupdatingPIDfile(/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pid). [root@Masterdata]#vimSlave1.Hadoop.err//查看日志文件 16083015:56:44mysqld_safeStartingmysqlddaemonwithdatabasesfrom/home/hadoop/ruanJian/mysql/data 2016-08-3015:56:490[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-3015:56:491990[ERROR]Fatalerror:Can'tchangetorunasuser'mysql';Pleasecheckthattheuserexists! 2016-08-3015:56:491990[ERROR]Aborting 2016-08-3015:56:491990[Note]Binlogend 2016-08-3015:56:491990[Note]/home/hadoop/ruanJian/mysql/bin/mysqld:Shutdowncomplete 16083015:56:49mysqld_safemysqldfrompidfile/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pidended
在mysql用户下创建data目录并解压
[root@Masterdata]#tar-zxvfmysql-5.6.12-linux-glibc2.5-x86_64.tar.gz [root@Masterdata]#mvmysql-5.6.12-linux-glibc2.5-x86_64mysql//重命名
设置权限
[root@Masterdata]#chown-Rmysql:mysqlmysql
切换用户并进入mysql/scripts目录
[root@Masterdata]#sumysql [mysql@Masterdata]$cdmysql/scripts/ [mysql@Masterscripts]$
安装(目录根据自己的mysql解压目录自行设置)
[mysql@Masterscripts]$./mysql_install_db--user=mysql--basedir=/home/mysql/data/mysql--datadir=/home/mysql/data/mysql/data
输出信息
InstallingMySQLsystemtables...2016-08-3019:55:410[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-3019:55:421354[Warning]Bufferedwarning:Changedlimits:max_open_files:1024(requested5000) 2016-08-3019:55:421354[Warning]Bufferedwarning:Changedlimits:table_cache:431(requested2000) 2016-08-3019:55:421354[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-3019:55:421354[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-3019:55:421354[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-3019:55:421354[Note]InnoDB:UsingLinuxnativeAIO 2016-08-3019:55:421354[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-3019:55:421354[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-3019:55:421354[Note]InnoDB:Completedinitializationofbufferpool 2016-08-3019:55:421354[Note]InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated! 2016-08-3019:55:421354[Note]InnoDB:Settingfile./ibdata1sizeto12MB 2016-08-3019:55:421354[Note]InnoDB:Databasephysicallywritesthefilefull:wait... 2016-08-3019:55:421354[Note]InnoDB:Settinglogfile./ib_logfile101sizeto48MB 2016-08-3019:55:431354[Note]InnoDB:Settinglogfile./ib_logfile1sizeto48MB 2016-08-3019:55:441354[Note]InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile0 2016-08-3019:55:441354[Warning]InnoDB:Newlogfilescreated,LSN=45781 2016-08-3019:55:441354[Note]InnoDB:Doublewritebuffernotfound:creatingnew 2016-08-3019:55:441354[Note]InnoDB:Doublewritebuffercreated 2016-08-3019:55:441354[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-3019:55:441354[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables. 2016-08-3019:55:441354[Note]InnoDB:Foreignkeyconstraintsystemtablescreated 2016-08-3019:55:441354[Note]InnoDB:Creatingtablespaceanddatafilesystemtables. 2016-08-3019:55:441354[Note]InnoDB:Tablespaceanddatafilesystemtablescreated. 2016-08-3019:55:441354[Note]InnoDB:Waitingforpurgetostart 2016-08-3019:55:441354[Note]InnoDB:5.6.12started;logsequencenumber0 2016-08-3019:55:441354[Note]Binlogend 2016-08-3019:55:441354[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-3019:55:441354[Note]InnoDB:Startingshutdown... 2016-08-3019:55:461354[Note]InnoDB:Shutdowncompleted;logsequencenumber1625977 OK Fillinghelptables...2016-08-3019:55:460[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-3019:55:461377[Warning]Bufferedwarning:Changedlimits:max_open_files:1024(requested5000) 2016-08-3019:55:461377[Warning]Bufferedwarning:Changedlimits:table_cache:431(requested2000) 2016-08-3019:55:461377[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-3019:55:461377[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-3019:55:461377[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-3019:55:461377[Note]InnoDB:UsingLinuxnativeAIO 2016-08-3019:55:461377[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-3019:55:461377[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-3019:55:461377[Note]InnoDB:Completedinitializationofbufferpool 2016-08-3019:55:461377[Note]InnoDB:HighestsupportedfileformatisBarracuda. 2016-08-3019:55:461377[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-3019:55:461377[Note]InnoDB:Waitingforpurgetostart 2016-08-3019:55:461377[Note]InnoDB:5.6.12started;logsequencenumber1625977 2016-08-3019:55:461377[Note]Binlogend 2016-08-3019:55:461377[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-3019:55:461377[Note]InnoDB:Startingshutdown... 2016-08-3019:55:481377[Note]InnoDB:Shutdowncompleted;logsequencenumber1625987 OK Tostartmysqldatboottimeyouhavetocopy support-files/mysql.servertotherightplaceforyoursystem PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER! Todoso,starttheserver,thenissuethefollowingcommands: /home/mysql/data/mysql/bin/mysqladmin-urootpassword'new-password' /home/mysql/data/mysql/bin/mysqladmin-uroot-hMaster.Hadooppassword'new-password' Alternativelyyoucanrun: /home/mysql/data/mysql/bin/mysql_secure_installation whichwillalsogiveyoutheoptionofremovingthetest databasesandanonymoususercreatedbydefault.Thisis stronglyrecommendedforproductionservers. Seethemanualformoreinstructions. YoucanstarttheMySQLdaemonwith: cd.;/home/mysql/data/mysql/bin/mysqld_safe& YoucantesttheMySQLdaemonwithmysql-test-run.pl cdmysql-test;perlmysql-test-run.pl Pleasereportanyproblemswiththe./bin/mysqlbugscript! ThelatestinformationaboutMySQLisavailableonthewebat http://www.mysql.com SupportMySQLbybuyingsupport/licensesathttp://shop.mysql.com Newdefaultconfigfilewascreatedas/home/mysql/data/mysql/my.cnfand willbeusedbydefaultbytheserverwhenyoustartit. Youmayeditthisfiletochangeserversettings WARNING:Defaultconfigfile/etc/my.cnfexistsonthesystem ThisfilewillbereadbydefaultbytheMySQLserver Ifyoudonotwanttousethis,eitherremoveit,orusethe --defaults-fileargumenttomysqld_safewhenstartingtheserver
配置文件
[mysql@Masterscripts]$cd../support-files/ [root@Mastersupport-files]#cpmy-default.cnf/etc/my.cnf [root@Mastersupport-files]#cpmysql.server/etc/init.d/mysql [root@Mastersupport-files]#vim/etc/init.d/mysql//修改mysql文件
添加以下两行
basedir=/home/mysql/data/mysql datadir=/home/mysql/data/mysql/data
配置环境变量
[root@Mastersupport-files]#vim/etc/profile #setmysqlenvironment exportMYSQL_HOME=/home/mysql/data/mysql exportPATH=$MYSQL_HOME/bin:$PATH
配置mysql服务开机自动启动
[root@Masterbin]#chkconfig--addmysql//添加mysql [root@Masterbin]#chkconfigmysqlon//设置开机启动
启动mysql
[root@Mastersupport-files]#servicemysqlstart env:/etc/init.d/mysql:权限不够//如果出现这个提示执行以下命令重新启动 [root@Mastersupport-files]#chmoda+wrx/etc/init.d/mysql [root@Mastersupport-files]#servicemysqlstart StartingMySQL..SUCCESS!//启动成功
设置root登录密码
[root@Master~]#cd/home/mysql/data/mysql/bin///进去mysql的bin目录 [root@Masterbin]#./mysqladmin-urootpassword'password'//'password'为自己设置的密码引号非必须 [root@Masterbin]#./mysqladmin-urootpasswordmysql [root@Masterbin]#mysql-uroot-p Enterpassword: WelcometotheMySQLmonitor.Commandsendwith;or\g. YourMySQLconnectionidis4 Serverversion:5.6.12MySQLCommunityServer(GPL) Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved. OracleisaregisteredtrademarkofOracleCorporationand/orits affiliates.Othernamesmaybetrademarksoftheirrespective owners. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement. mysql>
以上所述是小编给大家介绍的Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!