CentOS 7.3 官網離線安裝mysql 5.5
阿新 • • 發佈:2019-02-08
安裝環境
- CentOs 7.3
安裝包下載
執行命令
1.下載檔案並上傳
2.進入上傳檔案根目錄
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3:檢查是否安裝成功
yum repolist enabled | grep "mysql.*-community.*"
顯示正常如下:
[root@izwz9evdgm0j8lrd5ttie8z package]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 51
mysql-tools-community/x86_64 MySQL Tools Community 63
mysql57-community/x86_64 MySQL 5.7 Community Server 267
4:選擇安裝版本
vim /etc/yum.repos.d/mysql-community.repo
#### Enable to use MySQL 5.5 修改enabled 1(表示安裝) 或 0(不安裝)
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
5:啟動mysql服務
systemctl start mysqld
6:開機啟動
systemctl enable mysqld
systemctl daemon-reload
7:修改root 本地登入密碼
1.grep 'temporary password' /var/log/mysqld.log 獲取預設密碼
2.set password for 'root'@'localhost'=password('chenzhanmei');
3.flush privileges;
注意: 如果密碼忘記
vi /etc/my.conf
在[mysqld] 下面新增 skip-grant-tables
8:新增遠端登入使用者
GRANT ALL PRIVILEGES ON *.* TO 'zhanmei'@'%' IDENTIFIED BY 'Zhanmei1!' WITH GRANT OPTION;
9:配置預設編碼為UTF8
修改/etc/my.cnf配置檔案,在[mysqld]下新增編碼配置,如下所示:
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
10:預設配置檔案路徑:
配置檔案:/etc/my.cnf
日誌檔案:/var/log//var/log/mysqld.log
服務啟動指令碼:/usr/lib/systemd/system/mysqld.service
socket檔案:/var/run/mysqld/mysqld.pid