主頁(yè) > 知識(shí)庫(kù) > centOS安裝mysql5.7詳細(xì)教程

centOS安裝mysql5.7詳細(xì)教程

熱門標(biāo)簽:做地圖標(biāo)注都需要什么工具 凱立德科技館地圖標(biāo)注 銀川電銷外呼系統(tǒng)定制 甘孜電話機(jī)器人廠家 電銷機(jī)器人好品牌門薩維l 中科嘉智人工智能電銷機(jī)器人 西安400電話在哪里辦理 哈爾濱crm外呼系統(tǒng)價(jià)格 上海智能外呼系統(tǒng)需要多少錢

本文為大家分享了centOS下安裝mysql5.7詳細(xì)步驟,供大家參考,具體內(nèi)容如下

第一步:

第一句檢測(cè)系統(tǒng)是否自帶安裝mysql,若有執(zhí)行第二句刪除系統(tǒng)自帶的mysql及其依賴。

yum list installed | grep mysql
yum -y remove mysql-libs.x86_64

第二步:

給CentOS添加rpm源,并且選擇較新的源,下面代碼逐句執(zhí)行

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
yum-config-manager --disable mysql55-community
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
yum repolist enabled | grep mysql

第三步:

安裝mysql 服務(wù)器

yum install mysql-community-server

第四步:

service mysqld start

第五步:

查看mysql是否自啟動(dòng),并且設(shè)置開啟自啟動(dòng)

chkconfig --list | grep mysqld
chkconfig mysqld on

第六步:

這一步很重要?。?!

不知道從mysql哪個(gè)版本開始,mysql的root默認(rèn)密碼就不為空了,在安裝的過程中默認(rèn)密碼保存在安裝日志中了。我們要通過安裝日志找到默認(rèn)密碼,用默認(rèn)密碼登陸mysql成功后會(huì)強(qiáng)行讓你修改密碼,修改的密碼還要夠復(fù)雜(復(fù)合mysql默認(rèn)的密碼策略)才能修改成功,一般帶大小寫字母特殊字符和數(shù)字超過8個(gè)字符就可以。

首先找到安裝日志

find / -name mysqld.log

然后發(fā)現(xiàn)該日志文件路徑在 /var/log/mysqld.log。然后用下面命令打開,按‘i'鍵上翻

vim /var/log/mysqld.log

上圖紅色地方就是root密碼所在地

第七步:

mysql安全設(shè)置

mysql_secure_installation

輸入上面命令進(jìn)行下面步驟

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):–初次運(yùn)行,輸入剛剛找到的初始密碼,會(huì)強(qiáng)制你先修改密碼才能進(jìn)行下去
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] – 是否設(shè)置root用戶密碼,輸入y并回車或直接回車
New password: – 設(shè)置root用戶的密碼
Re-enter new password: – 再輸入一次你設(shè)置的密碼
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] – 是否刪除匿名用戶,生產(chǎn)環(huán)境建議刪除,所以直接回車
… Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] –是否禁止root遠(yuǎn)程登錄,根據(jù)自己的需求選擇Y/n并回車,建議禁止
… Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] – 是否刪除test數(shù)據(jù)庫(kù),直接回車
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] – 是否重新加載權(quán)限表,直接回車
… Success!
Cleaning up…
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@server1 ~]#

第八步:

可選步驟,原來Linux下的MySQL默認(rèn)是區(qū)分表名大小寫的,通過如下設(shè)置,可以讓MySQL不區(qū)分表名大小寫:
1、用root登錄,修改 /etc/my.cnf;
2、在[mysqld]節(jié)點(diǎn)下,加入一行: lower_case_table_names=1
3、重啟MySQL即可; service mysqld restart

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • CentOS7環(huán)境下源碼安裝MySQL5.7的方法
  • centos7利用yum安裝lnmp的教程(linux+nginx+php7.1+mysql5.7)
  • Centos7安裝和配置Mysql5.7
  • RedHat6.5/CentOS6.5安裝Mysql5.7.20的教程詳解
  • Centos7 移動(dòng)mysql5.7.19 數(shù)據(jù)存儲(chǔ)位置的操作方法
  • Centos7.5安裝mysql5.7.24二進(jìn)制包方式部署

標(biāo)簽:四川 濮陽(yáng) 山南 那曲 浙江 平頂山 安康 安徽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《centOS安裝mysql5.7詳細(xì)教程》,本文關(guān)鍵詞  centOS,安裝,mysql5.7,詳細(xì),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《centOS安裝mysql5.7詳細(xì)教程》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于centOS安裝mysql5.7詳細(xì)教程的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章