博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
yum 安装 mysql5.5 mysql 5.6 mysql5.7
阅读量:6624 次
发布时间:2019-06-25

本文共 3553 字,大约阅读时间需要 11 分钟。

 
一. yum 安装mysql5.6
1. 安装仓库
要使用yum 安装mysql,需要使用mysql的yum 仓库,先从官网下载适合你的系统仓库
 
然后安装一下这个仓库列表
wget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm
rpm -ivh mysql57-community-release-el6-5.noarch.rpm
或: # yum install
 
 
2.选择版本
查看可安装的mysql版本
[root@www ~]# yum repolist enabled | grep "mysql.*-community.*"
 
如果我们要选择版本,可以先执行下面命令查看一下有哪些版本
[root@www ~]# yum repolist all | grep mysql
 
选择版本启动5.6版本的,禁用5.7版本仓库
[root@www ~]# yum-config-manager --enable mysql56-community
[root@www ~]# yum-config-manager --disable mysql57-community
 
或者直接在yum 仓库中禁用mysql5.7的
编辑/etc/yum.repos.d/mysql-community.repo文件
enabled=0 表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库
 
[root@www yum.repos.d]# vim mysql-community.repo
###mysql5.5 全部禁用
15 # Enable to use MySQL 5.5
16 [mysql55-community]
17 name=MySQL 5.5 Community Server
18 baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/
19 enabled=0
20 gpgcheck=1
21 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
###开启mysql5.6
23 # Enable to use MySQL 5.6
24 [mysql56-community]
25 name=MySQL 5.6 Community Server
26 baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
27 enabled=1
28 gpgcheck=0
29 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
###mysql5.7 禁用
31 [mysql57-community]
32 name=MySQL 5.7 Community Server
33 baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
34 enabled=0
35 gpgcheck=1
36 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
 
这时在查看可安装mysql版本,只剩下mysql5.6
[root@www yum.repos.d]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community MySQL Connectors Community 42
mysql-tools-community MySQL Tools Community 51
mysql56-community MySQL 5.6 Community Server 396
 
 
安装mysql5.6
[root@www yum.repos.d]# yum install mysql-community-server
 
启动mysql数据库
[root@www yum.repos.d]# service mysqld start
MySQL Daemon failed to start.
启动报错,mysql Daemon 进程启动失败,查看错误日志: /var/log/mysqld.log
[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2017-11-20 00:00:20 5464 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-11-20 00:00:20 5464 [ERROR] Plugin 'InnoDB' init function returned error.
2017-11-20 00:00:20 5464 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-11-20 00:00:20 5464 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-11-20 00:00:20 5464 [ERROR] Aborting
 
解决方法: yum安装mysql5.6 数据目录位置:/var/lib/mysql
在此目录下删除: ibdata1 ib_logfile1 ib_logfile0 这三个目录,重启动mysql成功
 
 
更改mysql root 密码:
[root@www mysql]# mysqladmin -u root password '123123'
Warning: Using a password on the command line interface can be insecure.
mysqladmin: unable to change password; error: 'Column count of mysql.user is wrong. Expected 43, found 39. Created with MySQL 50171, now running 50638. Please use mysql_upgrade to fix this error.'
报错信息:依据提示 执行。
[root@www mysql]# mysql_upgrade
再次更改mysql密码成功
[root@www mysql]# mysqladmin -uroot password '123123'
Warning: Using a password on the command line interface can be insecure.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

转载于:https://www.cnblogs.com/lzcys8868/p/7867487.html

你可能感兴趣的文章
Ftp的断点下载实现
查看>>
[转载] ubuntu Authentication failure
查看>>
Ring0 - 链表
查看>>
修改数组之----splice
查看>>
a版本冲刺第五天
查看>>
Arduino示例教程超声波测距实验
查看>>
Redis操作hash
查看>>
ubuntu使sudo不需要密码
查看>>
How to pass in/out return VB Byte array from a COM Component written in C#
查看>>
轻松搞定个人虚拟桌面部署之5-在客户端测试远程桌面
查看>>
Linux中chkconfig使用介绍
查看>>
二进制方式快速安装MySQL数据库
查看>>
Centos5上部署udev
查看>>
挑战WORD极限排版之模板与加载项
查看>>
Tomcat配置多数据源
查看>>
(转)快速搭建PHP开发环境WAMP+ZendStudio+ZendDebugger
查看>>
js string format
查看>>
httpHandlers和httpModules接口介绍 (3)
查看>>
18、C++ Primer 4th 笔记,复制控制
查看>>
《大话数据结构》第9章 排序 9.1 开场白
查看>>