centos安装mysql教程
Author:zhoulujun Date:
之前在《服务器升级至centos8 网站配置-php与mysql从5.6升级到php7与msyql8》里面提到过centos8 安装mysql8
这里单独开一篇来讲一讲
单独按照mysql服务器,其实很简单
centos yum直接安装msyql
linux主流版本,都可以直接安装mysql
yum install mysql-server #CentOS and RedHat systems
apt install mysql-server #Ubuntu and Debian systems
dnf install mysql-server #Fedora 22+ systems
同理卸载也很简单:
yum remove mysql mysql-server #CentOS and RedHat systems
apt remove mysql mysql-server #Ubuntu and Debian systems
dnf remove mysql mysql-server #Fedora 22+ systems
这样,就可以直接操作mysql了
systemctl start mysqld #启动msyql
systemctl enable mysqld #设置开机启动mysql
systemctl status mysqld #查看mysql 状态
systemctl stop mysqld # 停止mysql
centos 安装mysql 所有服务
yum -y install @mysql
@mysql 会安装最新的mysql 版本以及所有的依赖模块,如果硬盘空间够的话,直接执行就好。
安装完毕后,直接启动服务器即可。
centos 手工安装msyql
第一,直接本地按照远程源
yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum install mysql-server
第二,下载到本地安装
rpm -qa | grep mysql # 查看是否有以及安装的mysql,如果有,先卸载
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm #安装mysql-community-release-el7-5.noarch.rpm包
yum repolist all | grep mysql #查看可用安装包
yum install mysql-server
需要注意的是,这样安装的mysql,启动命令不同
systemctl start mysqld.service
参考文章:
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-8
https://www.tecmint.com/install-mysql-on-centos-8/
转载本站文章《centos安装mysql教程》,
请注明出处:https://www.zhoulujun.cn/html/OS/Linux/LinuxDevops/8596.html