五月综合激情婷婷六月,日韩欧美国产一区不卡,他扒开我内裤强吻我下面视频 ,无套内射无矿码免费看黄,天天躁,日日躁,狠狠躁

新聞動(dòng)態(tài)

CentOS 7 下使用yum安裝MySQL5.7.20 最簡單方法

發(fā)布日期:2022-03-17 10:33 | 文章來源:gibhub

CentOS7默認(rèn)數(shù)據(jù)庫是mariadb, 但是 好多用的都是mysql ,但是CentOS7的yum源中默認(rèn)好像是沒有mysql的。

上一篇安裝的是5.6的但是我想安裝5.7的 yum安裝是最簡單的 嘗試過編譯安裝各種問題,最后就決定用yum。

(經(jīng)過一段時(shí)間的學(xué)習(xí)又寫了一篇用源碼安裝mysql5.7.22的 點(diǎn)擊打開鏈接)

1.卸載 先停掉mysql進(jìn)程 沒有安裝過的可以直接跳過

 pkill -9 mysqld  
  rpm -qa|grep -i mysql 

用命令 yum -y remove

  yum -y remove mysql-community-client-5.6.38-2.el7.x86_64

卸載不掉的用 rpm -ev

依次卸載 直到?jīng)]有

2.下載mysql的repo源 這個(gè)安裝的mysql5.7.20 /**糾正一下,這源下載的是最新的版本 ****/

 [root@localhost ~]# cd /usr/local/src/
 [root@localhost src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
 [root@localhost src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
 [root@localhost src]# yum -y install mysql-server

(也可以指定安裝目錄 yum --installroot=/usr/local/mysql --releasever=/ -y install mysql-server )我沒試,這樣裝環(huán)境變量配置都不用你管,裝上直接啟動(dòng)就行。安裝路徑是默認(rèn)的。

一路 y

根據(jù)步驟安裝就可以了,

默認(rèn)配置文件路徑:
配置文件:/etc/my.cnf
日志文件:/var/log/var/log/mysqld.log
服務(wù)啟動(dòng)腳本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid

配置 my.cnf vim /etc/my.cnf

[mysqld]
 #
 # Remove leading # and set to the amount of RAM for the most important data
 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
 # innodb_buffer_pool_size = 128M
 #
 # Remove leading # to turn on a very important data integrity option: logging
 # changes to the binary log between backups.
 # log_bin
 #
 # Remove leading # to set options mainly useful for reporting servers.
 # The server defaults are faster for transactions and fast SELECTs.
 # Adjust sizes as needed, experiment to find the optimal values.
 # join_buffer_size = 128M
 # sort_buffer_size = 2M
 # read_rnd_buffer_size = 2M
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 server_id = 1
 expire_logs_days = 3
 # Disabling symbolic-links is recommended to prevent assorted security risks
 symbolic-links=0
 log-error=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

不過安裝完成后,密碼為隨機(jī)密碼,需要重置密碼。

4. 啟動(dòng)mysql服務(wù)

service mysqld restart

重置密碼

 [root@localhost ~]# grep "password" /var/log/mysqld.log 

可以看到 輸入 mysql -u root -p 密碼 進(jìn)入 第一次登陸 ,需要重置密碼 要不什么也不能操作

接下來重置密碼:5.7.20 為了安全密碼 必須包含 數(shù)字字母符號

踩過的坑啊,設(shè)置了好幾次。還有這ip不能是% 不知道為什么 反正第一次設(shè)置成%沒成功 登上去之后再改就可以改了。

把密碼改簡單的方法 https://www.jb51.net/article/150472.htm

alter user 'root'@'localhost' identified by 'Root!!2018'; 

最后記得刷新權(quán)限;

flush privileges

也可以 直接再添加新用戶

 CREATE USER ‘root‘@‘%‘ IDENTIFIED BY ‘您的密碼‘;
 grant all on *.* to 'root001'@'%' identified by 'Root@@' with grant option;

增加root用戶指定可以任意IP登錄,如果想限制只能讓指定IP登錄請把%替換成IP地址

問題:如果發(fā)現(xiàn)找不到密碼?。。。?!

解決:只能通過忘記密碼的方式修改密碼!!! 在安裝的過程中發(fā)現(xiàn)找不到密碼???折騰了好長時(shí)間 通過修改密碼找回之后發(fā)現(xiàn)、原來之前安裝的數(shù)據(jù)庫在了,就沒有生產(chǎn)新的數(shù)據(jù)庫!!用的還是之前的配置。

2.看mysql啟動(dòng)了沒?初始化數(shù)據(jù)庫了沒? 一般直接啟動(dòng) 數(shù)據(jù)庫 就可以 用grep "password" /var/log/mysqld.log 看到隨機(jī)密碼了

修改MySQL的登錄設(shè)置:

#vi /etc/my.cnf

在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi。

重新啟動(dòng)mysqld

重新啟動(dòng)mysqld
 #/etc/init.d/mysqld restart ( service mysqld restart )
 use mysql 
 update user set password=password("12345") where user="root";
 mysql 5.7的數(shù)據(jù)庫沒有了password字段 用的是authentication_string字段
mysql> update mysql.user set authentication_string=password('root') where user='root' ;
 flush privileges;

修改密碼之后在改回來。

總結(jié)

以上所述是小編給大家介紹的CentOS 7 下使用yum安裝MySQL5.7.20 最簡單方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對本站網(wǎng)站的支持!

香港服務(wù)器租用

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實(shí)時(shí)開通

自選配置、實(shí)時(shí)開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部