linux的mysql安装与卸载

·  centos6.5上安装mysql5.6.26

通过rpm包安装:

[root@cobub01 mysql-5.6]# rpm -iv MySQL-server-5.6.26-1.el6.x86_64.rpm
warning: MySQL-server-5.6.26-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing packages for installation...
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.26-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
.............................

移除已经存在的 mysql-libs-5.1.73-5.el6_6.x86_64

yum remove mysql-libs-5.1.73-5.el6_6.x86_64

卸载成功后,重新执行rpm安装:

[root@cobub01 mysql-5.6]# rpm -iv MySQL-server-5.6.26-1.el6.x86_64.rpm
warning: MySQL-server-5.6.26-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
................................
2015-09-21 04:20:10 6445 [Note] InnoDB: FTS optimize thread exiting.
2015-09-21 04:20:10 6445 [Note] InnoDB: Starting shutdown...
2015-09-21 04:20:17 6445 [Note] InnoDB: Shutdown completed; log sequence number 1625987

安装mysql-client:

[root@cobub01 mysql-5.6]# rpm -iv MySQL-client-5.6.26-1.el6.x86_64.rpm
warning: MySQL-client-5.6.26-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing packages for installation...
MySQL-client-5.6.26-1.el6

 启动mysql:

chkconfig mysql on // 设置mysql开机启动
service mysql start

重置mysql 默认的root用户密码(在/root/.mysql_secret中获取安装后自动生成的root随机密码)

扫描二维码关注公众号,回复: 381940 查看本文章
[root@cobub01 mysql-5.6]# mysql -uroot -pdzj_hclH3V7nVRb7
Warning: Using a password on the command line interface can be insecure.
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
mysql> set password for root@localhost = password('root');
Query OK, 0 rows affected (0.01 sec)

 ===========================================

· 卸载mysql

a)查看系统中是否以rpm包安装的mysql:

[root@cobub04 mysql-5.6]# rpm -qa | grep -i mysql
MySQL-server-5.6.26-1.el6.x86_64
MySQL-client-5.6.26-1.el6.x86_64

 卸载MySQL-server-5.6.26-1.el6.x86_64和MySQL-client-5.6.26-1.el6.x86_64

[root@cobub04 mysql-5.6]# rpm -e MySQL-server-5.6.26-1.el6.x86_64

 

b) 查看有没有mysql服务

[root@linux ~]# chkconfig --list | grep -i mysql

    删除服务

[root@linux ~]# chkconfig --del mysql

c)删除分散mysql文件夹

[root@linux ~]# whereis mysql
mysql: /usr/lib/mysql /usr/share/mysql

    分别删除

[root@linux lib]# rm -rf /usr/lib/mysql/
[root@linux lib]# rm -rf /usr/share/mysql

猜你喜欢

转载自oitebody.iteye.com/blog/2245037