- 卸载centos7自带MariaDB
rpm –qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
- 下载mysql版本 (等待下载完成)
wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/MySQL-5.6.45-1.el7.x86_64.rpm-bundle.tar
wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6/MySQL-5.6.45-1.el7.x86_64.rpm-bundle.tar
- 解压文件
tar -xvf MySQL-5.6.42-1.el7.x86_64.rpm-bundle.tar
- 安装
rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.42-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpm
- 启动
service mysql start
- 打开mysql输入
msyql
- 创建mysql用户
grant all privileges on *.* to mysql@'%' identified by '123456' with grant option;
flush privileges;
- 如果有些配置不生效重启mysql
service msyql restart;
所遇问题
安装过程中如果需要依赖包请自行yum安装
- 问题1
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
perl(Data::Dumper) is needed by MySQL-server-5.6.42-1.el7.x86_64
- 解决办法:
cd /etc/pki/rpm-gpg
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install perl perl-devel perl-Data-Dumper
如果还不行:rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm --force --nodeps 强安装
- 问题2:启动时如果报错:
Starting MySQL.Logging to '/var/lib/mysql/izuf66sgxgoyt19dbhtlqdz.err'.
.The server quit without updating PID file (/var/lib/mysql/[FAILED]xgoyt19dbhtlqdz.pid).
- 解决办法:
cat /var/lib/mysql/izuf66sgxgoyt19dbhtlqdz.err
执行: mysql_install_db --user=mysql --ldata=/var/lib/mysql/