linux安装mysql
去mysql官网下载MySQL安装程序(for Linux),网址:https://dev.mysql.com/downloads/mysql/
将MySQL程序(如:mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar)上传到服务器的/opt/dzgd/目录。
使用命令解压缩该文件,tar –xf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
使用命令查询已安装的mysql模块,rpm –qa | grep mariadb
使用命令删除系统自带的mariadb,rpm –e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
安装MySQL:
rpm –ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
rpm –ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm
rpm –ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
rpm –ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
rpm –ivh mysql-community-devel-5.7.21-1.el7.x86_64.rpm
设置数据库初始密码:
mysql –u root –p –P 3307 –h 127.0.0.1
set password=password(‘xxxxxxxxxxx’);
在线安装
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server
yum install mysql-devel