MySQL官方文件
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
1.更新Yum Repository
於https://dev.mysql.com/downloads/repo/yum/
下載
Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package | 25.1K | ||
(mysql57-community-release-el7-11.noarch.rpm) |
下載後執行
sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
2.更新套件庫
yum -y update
3.更新php 7
參考 https://www.phpini.com/linux/rhel-centos-7-install-php-7
首先下載 Remi 及 EPEL Repository:
# wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安裝 EPEL Repository:
安裝 Remi Repository:
選擇要安裝PHP 7.0或7.1
PHP7.0
# yum-config-manager --enable remi-php70
PHP7.1
# yum-config-manager --enable remi-php71
注意事項:上方指令需額外安裝套件
搜尋在哪一個套件 yum search yum-config-manager 找到安裝該套件
$ yum search yum-config-manager Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.yzu.edu.tw * epel: mirror01.idc.hinet.net * extras: ftp.yzu.edu.tw * remi-safe: mirror.innosol.asia * updates: ftp.yzu.edu.tw =================================== Matched: yum-config-manager =================================== remi-release.noarch : YUM configuration for remi repository yum-utils.noarch : Utilities based around the yum package manager $ yum install yum-utils
# yum install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
檢查版本
# php –version
4.安裝mysql 5.7.20
yum install -y mysql-community-server
5.啟動
systemctl start mysqld.service
6.檢核狀態
systemctl status mysqld.service
7.尋找MySQL root預設密碼
grep "password" /var/log/mysqld.log
找到
A temporary password is generated for root@localhost: lpqF0PfarS+h
8.登入MySQL
依據步驟7.
mysql -u root -p
輸入密碼
9.更改預設密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密碼';
10.設定為開機自動啟動
systemctl enable mysqld
11.設定防火牆與許外網存取MySQL服務(此處依狀況修改)
firewall-cmd --zone=public --add-service=mysql
12.重新載入規則
firewall-cmd --reload
13.安裝Workbench
yum install mysql-workbench-community
留言列表