OEL7.6源码安装MYSQL5.7的示例分析
这篇文章主要介绍了OEL7.6源码安装MYSQL5.7的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
首先官网下载安装包https://dev.mysql.com/downloads/mysql/5.7.html#downloads
然后上传解压至/usr/local目录
[root@localhostdb]#tar-xfmysql-5.7.26-linux-glibc2.12-x86_64.tar[root@localhostdb]#tar-xzfmysql-5.7.26-linux-glibc2.12-x86_64.tar.gz[root@localhostdb]#mvmysql-5.7.26-linux-glibc2.12-x86_64/usr/local/mysql[root@localhostdb]#
然后创建mysql用户和组以及数据目录
[root@localhostdb]#mvmysql-5.7.26-linux-glibc2.12-x86_64/usr/local/mysql[root@localhostdb]#groupaddmysql[root@localhostdb]#useraddmysql-gmysql[root@localhostdb]#cd/usr/local/mysql[root@localhostmysql]#mkdirdata[root@localhostmysql]#chownmysql:-R/usr/local/mysql/[root@localhostmysql]#
然后初始化数据并记录临时密码
[root@localhostmysql]#bin/mysqld--initialize--user=mysql--datadir/usr/local/mysql/data2019-07-26T01:34:24.479757Z0[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2019-07-26T01:34:24.682695Z0[Warning]InnoDB:Newlogfilescreated,LSN=457902019-07-26T01:34:24.717419Z0[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables.2019-07-26T01:34:24.723157Z0[Warning]NoexistingUUIDhasbeenfound,soweassumethatthisisthefirsttimethatthisserverhasbeenstarted.GeneratinganewUUID:8009a802-af45-11e9-839c-000c29984aae.2019-07-26T01:34:24.723996Z0[Warning]Gtidtableisnotreadytobeused.Table'mysql.gtid_executed'cannotbeopened.2019-07-26T01:34:24.724629Z1[Note]Atemporarypasswordisgeneratedforroot@localhost:ucZ5w5ZkSq;1[root@localhostmysql]#
然后修改/etc/my.cnf配置文件中datadir为/usr/local/mysql/data
[root@localhostmysql]#cat/etc/my.cnf[mysqld]datadir=/usr/local/mysql/data[root@localhostmysql]#
然后将mysql加入init.d目录并启动mysql
[root@localhostmysql]#cpsupport-files/mysql.server/etc/init.d/mysqld[root@localhostmysql]#/etc/init.d/mysqldstartStartingMySQL.Loggingto'/usr/local/mysql/data/localhost.localdomain.err'.SUCCESS![root@localhostmysql]#ps-ef|grepmysqlroot129571009:37pts/000:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/usr/local/mysql/data--pid-file=/usr/local/mysql/data/localhost.localdomain.pidmysql1305712957409:37pts/000:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=localhost.localdomain.err--pid-file=/usr/local/mysql/data/localhost.localdomain.pidroot1309210198009:37pts/000:00:00grep--color=automysql[root@localhostmysql]#
最后mysql/bin加入path,并登陆数据库并重设密码
[root@localhostbin]#./mysql-uroot-pEnterpassword:WelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis2Serverversion:5.7.26Copyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>setpassword=password('mysql');QueryOK,0rowsaffected,1warning(0.00sec)mysql>exitBye[root@localhostbin]#./mysql-uroot-pEnterpassword:ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:YES)[root@localhostbin]#./mysql-uroot-pEnterpassword:WelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis4Serverversion:5.7.26MySQLCommunityServer(GPL)Copyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>showdatabases;+--------------------+|Database|+--------------------+|information_schema||mysql||performance_schema||sys|+--------------------+4rowsinset(0.01sec)mysql>
感谢你能够认真阅读完这篇文章,希望小编分享的“OEL7.6源码安装MYSQL5.7的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。