之前系统用的数据库一直是5.1 的,突然要更新成5.7 以为直接yum -y mysqld 就可以了,结果centos 默认安装的还是5.1
1.先建好存rpm包的文件夹
mkdir -p /usr/rmp
cd /usr/rmp
2.下载官方的rpm 包
wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm
3.添加yum源到存储库中
yum localinstall mysql57-community-release-el6-{version-number}.noarch.rpm
4.安装
yum install mysql-community-server
注意:到这一步,如果你在此之前试过yum 安装的话可能会出现一下这一对代码,这个是因为已经有一个yum 进程还在继续
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 63 M RSS (508 MB VSZ)
Started: Sun Jun 11 15:53:20 2017 - 00:21 ago
State : Traced/Stopped, pid: 3197
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 63 M RSS (508 MB VSZ)
Started: Sun Jun 11 15:53:20 2017 - 00:23 ago
State : Traced/Stopped, pid: 3197
使用kill -s 9 3197 (3197进程pid)即可杀死进程
在执行一次即可安装
启动
service mysqld start
mysql -u root -p
5.设置密码
先关闭数据库服务
service mysqld stop
vim /etc/my.cnf
添加 skip-grant-tables(跳过密码)
·········启动服务
关闭文件后 用mysql -u root直接登入 用以下命令操作密码
update mysql.user set authentication_string=password('至少8位') where User='root' and Host='localhost';
接着在重启一遍 用密码进行登入
如果有错误的地方请指出!