centos安装mysql5.5 两种方式: 离线,在线

1, centos6 安装mysql 5.5

A, 离线安装

centos6 mysql5.5 离线包下载: https://dev.mysql.com/downloads/mysql/5.5.html#downloads
【mysql5.5安装后默认没有密码, 比其他的版本方便】

#1, 删除已安装的mysql服务, 顺序安装新的rpm包
rpm -qa |grep mysql |xargs -n 1 rpm -e --nodeps
whereis mysql  |xargs -n 1 rm -rf
whereis mysqld |xargs -n 1 rm -rf
rm -rf /var/lib/mysql
 
#2,安装mysql5.5
mkdir ~/mysqls
tar -xvf  ~/MySQL-5.5.62-1.el6.x86_64.rpm-bundle.tar -C ~/mysqls ; cd ~/mysqls
rpm -ivh MySQL-devel-5.5.62-1.el6.x86_64.rpm  --nodeps --force
rpm -ivh MySQL-shared-5.5.62-1.el6.x86_64.rpm  --nodeps --force
rpm -ivh MySQL-shared-compat-5.5.62-1.el6.x86_64.rpm  --nodeps --force
rpm -ivh MySQL-embedded-5.5.62-1.el6.x86_64.rpm  --nodeps --force
rpm -ivh MySQL-client-5.5.62-1.el6.x86_64.rpm  --nodeps --force
rpm -ivh MySQL-server-5.5.62-1.el6.x86_64.rpm  --nodeps --force

#启动mysql,设置root密码
service mysql start
mysqladmin -u root password '123456'

centos安装mysql5.5 两种方式: 离线,在线_第1张图片

B, 在线安装

#1,  删除已安装的mysql服务, 顺序安装新的rpm包
rpm -qa |grep mysql |xargs -n 1 rpm -e --nodeps
whereis mysql  |xargs -n 1 rm -rf
whereis mysqld |xargs -n 1 rm -rf
rm -rf /var/lib/mysql
 
yum -y install wget
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum list |grep mysql 
yum -y install mysql-server mysql mysql-devel
 
#2, 启动服务,修改root密码
service mysqld start
service mysqld status
mysqladmin -u root password 123456

centos安装mysql5.5 两种方式: 离线,在线_第2张图片

2, centos7 安装 mysql 5.5

  • 在线安装
wget -c https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 
rpm -ivh mysql57-community-release-el7-11.noarch.rpm 
yum -y install mysql mysql-server

你可能感兴趣的:(linux系统)