R1-003 MySQL的rpm安装实例

1、解压tar包
[root@hhu MySQL]# tar -xvf MysqL-5.7.17-1.el6.x86_64.rpm-bundle.tar
MysqL-community-test-5.7.17-1.el6.x86_64.rpm
MysqL-community-embedded-5.7.17-1.el6.x86_64.rpm
MysqL-community-embedded-devel-5.7.17-1.el6.x86_64.rpm
MysqL-community-server-5.7.17-1.el6.x86_64.rpm
MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm
MysqL-community-devel-5.7.17-1.el6.x86_64.rpm
MysqL-community-client-5.7.17-1.el6.x86_64.rpm
MysqL-community-libs-5.7.17-1.el6.x86_64.rpm
MysqL-community-common-5.7.17-1.el6.x86_64.rpm
[root@hhu MysqL]# ls
MysqL-5.7.17-1.el6.x86_64.rpm-bundle.tar MysqL-community-embedded-devel-5.7.17-1.el6.x86_64.rpm
MysqL-community-client-5.7.17-1.el6.x86_64.rpm MysqL-community-libs-5.7.17-1.el6.x86_64.rpm
MysqL-community-common-5.7.17-1.el6.x86_64.rpm MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm
MysqL-community-devel-5.7.17-1.el6.x86_64.rpm MysqL-community-server-5.7.17-1.el6.x86_64.rpm
MysqL-community-embedded-5.7.17-1.el6.x86_64.rpm MysqL-community-test-5.7.17-1.el6.x86_64.rpm
2、卸载已有老版本MysqL
[root@hhu MysqL]# rpm -qa|grep MysqL
MysqL-5.1.71-1.el6.x86_64
MysqL-devel-5.1.71-1.el6.x86_64
MysqL-libs-5.1.71-1.el6.x86_64
[root@hhu MysqL]# rpm -e MysqL-5.1.71-1.el6.x86_64
error: Failed dependencies:
MysqL = 5.1.71-1.el6 is needed by (installed) MysqL-devel-5.1.71-1.el6.x86_64
[root@hhu MysqL]# rpm -e MysqL-devel-5.1.71-
[root@hhu MysqL]# rpm -qa|grep MysqL
MysqL-5.1.71-1.el6.x86_64
MysqL-libs-5.1.71-1.el6.x86_64
[root@hhu MysqL]# rpm -e MysqL-5.1.71-1.el6.x86_64
[root@hhu MysqL]# rpm -e MysqL-libs-5.1.71-1.el6.x86_64
error: Failed dependencies:
libMysqLclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libMysqLclient.so.16(libMysqLclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
MysqL-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@hhu MysqL]# rpm -e MysqL-libs-5.1.71-1.el6.x86_64 --nodeps 强制卸载
[root@hhu MysqL]# rpm -qa|grep MysqL
[root@hhu MysqL]#
3、安装MysqL包,一共5个,会有依赖关系,安装顺序如下:
rpm -Uvh MysqL-community-common-5.7.17-1.el6.x86_64.rpm
rpm -Uvh MysqL-community-libs-5.7.17-1.el6.x86_64.rpm
rpm -Uvh MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm
rpm -Uvh MysqL-community-client-5.7.17-1.el6.x86_64.rpm
rpm -Uvh MysqL-community-server-5.7.17-1.el6.x86_64.rpm
[root@hhu MysqL]# ls
MysqL-5.7.17-1.el6.x86_64.rpm-bundle.tar MysqL-community-embedded-devel-5.7.17-1.el6.x86_64.rpm
MysqL-community-client-5.7.17-1.el6.x86_64.rpm MysqL-community-libs-5.7.17-1.el6.x86_64.rpm
MysqL-community-common-5.7.17-1.el6.x86_64.rpm MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm
MysqL-community-devel-5.7.17-1.el6.x86_64.rpm MysqL-community-server-5.7.17-1.el6.x86_64.rpm
MysqL-community-embedded-5.7.17-1.el6.x86_64.rpm MysqL-community-test-5.7.17-1.el6.x86_64.rpm
[root@hhu MysqL]# rpm -Uvh MysqL-community-common-5.7.17-1.el6.x86_64.rpm
warning: MysqL-community-common-5.7.17-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MysqL-community-common ########################################### [100%]
[root@hhu MysqL]# rpm -Uvh MysqL-community-libs-5.7.17-1.el6.x86_64.rpm
warning: MysqL-community-libs-5.7.17-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MysqL-community-libs ########################################### [100%]
[root@hhu MysqL]# rpm -Uvh MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm
warning: MysqL-community-libs-compat-5.7.17-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MysqL-community-libs-co########################################### [100%]
[root@hhu MysqL]# rpm -Uvh MysqL-community-client-5.7.17-1.el6.x86_64.rpm
warning: MysqL-community-client-5.7.17-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MysqL-community-client ########################################### [100%]
[root@hhu MysqL]# rpm -Uvh MysqL-community-server-5.7.17-1.el6.x86_64.rpm
warning: MysqL-community-server-5.7.17-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MysqL-community-server ########################################### [100%]
[root@hhu MysqL]# service MysqLd status
MysqLd is stopped
[root@hhu MysqL]# service MysqLd start
Initializing MysqL database: [ OK ]
Installing validate password plugin: [ OK ]
Starting MysqLd: [ OK ]
4、获取超级数据库用户临时密码,登录修改密码
[root@hhu MysqL]# grep 'temporary password' /var/log/MysqLd.log
2017-02-23T01:36:39.249352Z 1 [Note] A temporary password is generated for root@localhost: i7NmqxstDZ?L
[root@hhu MysqL]# MysqL -uroot -p
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 4
Server version: 5.7.17
copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.00 sec)

MysqL> quit
Bye

相关文章

优化MySQL数据库发布系统存储的方法有:1.mysql库主从读写分...
使用mysql的方法:在“我的电脑”→右键→“管理”→“服务”...
在mysql中查看root用户权限的方法:1.命令行启动mysql服务;...
MySQL主从复制是用来备份一个与主数据库一样环境的从数据库,...
运行mysql的方法1.启动mysql服务,在“我的电脑”→右键→“...
开启mysql的方法1.可以通过快捷键win+r,输入cmd,打开窗口,...