如果是在Ubuntu 會簡單一點點,直接下
sudo apt install mysql-server
首先需要有 wget 或 curl 指令:
yum install wget
加入 MySQL Yum Repository
根據不同的發行版下載相應的 RPM 及安裝:
RHEL 7, CentOS 7:
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm yum localinstall mysql57-community-release-el7-7.noarch.rpm
RHEL 6, CentOS 6:
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm yum localinstall mysql57-community-release-el6-7.noarch.rpm
Fedora 23:
wget http://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm dnf localinstall mysql57-community-release-fc23-7.noarch.rpm
Fedora 22:
wget http://dev.mysql.com/get/mysql57-community-release-fc22-7.noarch.rpm dnf localinstall mysql57-community-release-fc22-7.noarch.rpm
安裝 MySQL
啟用了 MySQL 的 YUM Repository 後, 可以用 yum 或 dnf 安裝 MySQL 最新版, 目前最新版是 MySQL 5.7:
RHEL, CentOS:
yum install mysql-community-server
Fedora:
dnf install mysql-community-server
查看服務的裝態:
systemctl status mysql
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-07-12 17:46:42 UTC; 17s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 7918 (mysqld)
Status: "SERVER_OPERATING"
Tasks: 37 (limit: 1152)
CGroup: /system.slice/mysql.service
└─7918 /usr/sbin/mysqld
Active: active (running)
啟動 MySQL:
service mysqld start
或
service mysql start
說明:使用ubuntu 安裝 mysql-server ,service name 會是 mysql 而不是 mysqld。
相關文章:
mysql 安裝好後,root 的 temp password
https://stackoverflow.max-everyday.com/2017/12/mysql-root-temp-password/