CentOS7安装调试Mysql数据库的步骤详解【实例】
本实例要求下载并安装调试Mysql数据库。
第一步:下载Mysql数据库安装所需的全部软件。
我已提前下载好数据库软件,直接在服务器下载即可,如下:
通过scp直接下载:
[root@agt20~]#scproot@192.168.122.10:/root/mysql*/root/
软件如下图:
[root@agt20~]#lsmysql-* mysql-5.7.17.tar mysql-community-client-5.7.17-1.el7.x86_64.rpm mysql-community-common-5.7.17-1.el7.x86_64.rpm mysql-community-devel-5.7.17-1.el7.x86_64.rpm mysql-community-embedded-5.7.17-1.el7.x86_64.rpm mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm mysql-community-libs-5.7.17-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm mysql-community-server-5.7.17-1.el7.x86_64.rpm mysql-community-test-5.7.17-1.el7.x86_64.rpm
第二步:通过yum进行安装,起服务器并查看
[root@agt20~]#yum-yinstallmysql-*.rpm [root@agt20~]#systemctlrestartmysqld [root@agt20~]#systemctlenablemysqld [root@agt20~]#systemctlstatusmysqld.service \u25cfmysqld.service-MySQLServer Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendorpreset:disabled) Active:active(running)since\u4e8c2019-10-1511:29:11CST;1min15sago Docs:man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html MainPID:31584(mysqld) CGroup:/system.slice/mysqld.service \u2514\u250031584/usr/sbin/mysqld--daemonize--pid-file=/var/run/mysqld/mysqld.pid... 10\u67081511:28:42agt20.tedu.cnsystemd[1]:StartingMySQLServer... 10\u67081511:29:11agt20.tedu.cnsystemd[1]:StartedMySQLServer. [root@agt20~]#
第三步:连接MySQL服务器,修改密码;
1)查看初始密码
[root@agt20~]#grep-i'password'/var/log/mysqld.log 2019-10-15T03:28:55.200931Z1[Note]Atemporarypasswordisgeneratedforroot@localhost:r3qhDysMrM)
2)使用初始密码连接mysql服务
[root@agt20~]#mysql-uroot-p'r3qhDysMrM)' mysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure. WelcometotheMySQLmonitor.Commandsendwith;or\g. YourMySQLconnectionidis4 Serverversion:5.7.17 Copyright(c)2000,2016,Oracleand/oritsaffiliates.Allrightsreserved. OracleisaregisteredtrademarkofOracleCorporationand/orits affiliates.Othernamesmaybetrademarksoftheirrespective owners. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement. mysql>
3)重置数据库管理员roo本机登录密码
mysql>alteruserroot@localhostidentifiedby'Pwd@123...'; QueryOK,0rowsaffected(0.00sec)
4)修改密码策略
mysql>setglobalvalidate_password_policy=0; QueryOK,0rowsaffected(0.01sec) mysql>setglobalvalidate_password_length=6; QueryOK,0rowsaffected(0.00sec) mysql>alteruserroot@localhostidentifiedby'pwd@123'; QueryOK,0rowsaffected(0.00sec)
5)使用修改后的密码登录
[root@agt20~]#mysql-uroot-ppwd@123 mysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure. WelcometotheMySQLmonitor.Commandsendwith;or\g. YourMySQLconnectionidis5 Serverversion:5.7.17MySQLCommunityServer(GPL) Copyright(c)2000,2016,Oracleand/oritsaffiliates.Allrightsreserved. OracleisaregisteredtrademarkofOracleCorporationand/orits affiliates.Othernamesmaybetrademarksoftheirrespective owners. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement. mysql>
至此Mysql数据库安装调试完成!!!!
总结
以上所述是小编给大家介绍的CentOS7安装调试Mysql数据库的步骤详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!