這篇文章主要介紹了使用yum在linux(centos 7)下linuxlinux 5.7.18的教程詳解,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
項目需要使用MySQL,由于以前都是在windows下傻瓜式安裝,基本沒有遇到什么問題,但是這次是在服務器上安裝,由于到Linux上安裝軟件不熟悉,走了不少彎路,耽誤了好多時間??偨Y下來,以免下次再走彎路。
一、各種環(huán)境:
linux版本:CentOS Linux release 7.2.1511 (core)?
mysql版本:community sercer 5.7.18
使用的yum安裝包:
Red?Hat?Enterprise?Linux?7?/?Oracle?Linux?7?(Architecture?Independent),?RPM?Package??25.1K? Download (mysql57-community-release-el7-11.noarch.rpm)
二 :安裝步驟
我是先在windows上下載安裝包,然后通過xshell導入到服務器中。然后根據(jù)mysql官網(wǎng)上的步驟安裝的。任何教程都沒有官網(wǎng)上的靠譜,之前在網(wǎng)上搜了好多教程,每個教程的安裝方法都不一樣,搞得我很郁悶,而且,都沒有成功。最后還是通過官網(wǎng)上的教程安裝成功。
2.1 選擇安裝指南
2.2 點進入之后選擇通用二進制版本。? installing MySQL on Unix/Linux Using Generic Binaries
2.3 按照上面的操作一步一步執(zhí)行就可以了。
shell>?yum?search?libaio?#?search?for?info(Mysql安裝需要以來libaio庫,所以需要先安裝libaio庫) shell>?yum?install?libaio?#?install?library shell>?groupadd?mysql shell>?useradd?-r?-g?mysql?-s?/bin/false?mysql shell>?cd?/usr/local shell>?tar?zxvf?/path/to/mysql-VERSION-OS.tar.gz shell>?ln?-s?full-path-to-mysql-VERSION-OS?mysql shell>?cd?mysql shell>?mkdir?mysql-files shell>?chmod?750?mysql-files shell>?chown?-R?mysql?. shell>?chgrp?-R?mysql?. shell>?bin/mysql_install_db?--user=mysql??#?MySQL?5.7.5?(mysql5.7.5選擇使用這個命令,如果你的mysql是5.7.6及以上,不需要執(zhí)行這個命令) shell>?bin/mysqld?--initialize?--user=mysql?#?MySQL?5.7.6?and?up shell>?bin/mysql_ssl_rsa_setup???????#?MySQL?5.7.6?and?up shell>?chown?-R?root?. shell>?chown?-R?mysql?data?mysql-files shell>?bin/mysqld_safe?--user=mysql?& #?Next?command?is?optional shell>?cp?support-files/mysql.server?/etc/init.d/mysql.server
執(zhí)行完以上所有步驟,安裝就結束了。
2.4 安裝結束后,啟動mysql服務
[root@*****?/]#?cd?~?#這里有一個問題,不知道需要需要切換到?“~”目錄,之前沒有“~”,啟動不成功,不確定是我sytemctl?start?mysqld.service命令輸入錯了還是別的原因。 [root@*****?~]#?sytemctl?start?mysqld.service
查看是否啟動成功
[root@*****?~]#?sytemctl?status?mysqld.service
如果有這個標識則啟動成功
2.5 獲取安裝時的臨時密碼,用以登錄mysql
grep'temporary ?password'/var/log/mysqld.log 2017-05-10T00:55:46.982233Z ?1?[Note]?A?temporary?password?is?generated?for?root@localhost:?5C::+lMjqi+z
紅框中的是臨時密碼。
2.5 使用臨時密碼登錄
[root@******?~]#?mysql?-uroot?-p Enter?password:? Welcome?to?the?MySQL?monitor.?Commands?end?with?;?or?g. Your?MySQL?connection?id?is?5 Server?version:?5.7.18
2.6 更改密碼
mysql>?ALTER?USER?'root'@'localhost'?IDENTIFIED?BY?'newpassword'; Query?OK,?0?rows?affected?(0.00?sec)
注意:最新的mysql對linux性有很高的要求,密碼必須包含linux、大小寫、數(shù)字,否則更改不成功,報錯。
????? ERROR 1819 (HY000): Your password does not satisfy the linux policy requirements
以上所述是小編給大家介紹的使用YUM在Linux(CentOS 7)下安裝mysql 5.7.18的教程詳解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。
【相關推薦】
1.?特別推薦:linux