mysql学习心得之linux卸载mysql与rpm包安装(3)

本文介绍了如何在Oracle Linux6.4上卸载预装的MySQL,并通过RPM包进行安装的学习过程,适合初学者了解Linux环境下MySQL的管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天安装了一个oracle linux6.4的虚拟机,默认竟然安装了mysql,本想开始学习怎么在linux下安装mysql的,现在只好先学习怎么卸载吧。

首先查找安装的mysql的rpm包。

[root@mysql /]# rpm -qa|grep -i mysql
mysql-devel-5.1.71-1.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
qt-mysql-4.6.2-26.el6_4.x86_64
mysql-libs-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
为了不带上linux包的依赖校验,我们需要用如下的命令卸载上面的包。

[root@mysql /]# rpm -ev --allmatches --nodeps  mysql-devel-5.1.71-1.el6.x86_64
[root@mysql /]# rpm -ev --allmatches --nodeps  mysql-server-5.1.71-1.el6.x86_64
[root@mysql /]# rpm -ev --allmatches --nodeps  mysql-5.1.71-1.el6.x86_64
[root@mysql /]# rpm -ev --allmatches --nodeps  mysql-libs-5.1.71-1.el6.x86_64
[root@mysql /]# rpm -ev --allmatches --nodeps  qt-mysql-4.6.2-26.el6_4.x86_64
[root@mysql /]# rpm -ev --allmatches --nodeps  perl-DBD-MySQL-4.013-3.el6.x86_64

下面就是把我们的mysql的rpm包传到linux上去,在mysql5,.1的中文官方文档里面说了这样一句话“在大多数情况,你只需要安装MySQL-serverMySQL-client软件包来安装MySQL”。所以我们这里就只安装这两个包。

[root@mysql Csong]# rpm -ivh MySQL-client-5.5.47-1.el6.x86_64.rpm 
warning: MySQL-client-5.5.47-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@mysql Csong]# rpm -ivh MySQL-server-5.5.47-1.el6.x86_64.rpm 
warning: MySQL-server-5.5.47-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
151231 16:11:54 [Note] /usr/sbin/mysqld (mysqld 5.5.47) starting as process 5079 ...
151231 16:11:54 [Note] /usr/sbin/mysqld (mysqld 5.5.47) starting as process 5086 ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h mysql password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/
[root@mysql Csong]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@mysql Csong]# service mysql start
Starting MySQL..                                           [  OK  ]
[root@mysql Csong]# mysqladmin -u root password 123456
[root@mysql Csong]# mysql -uroot -p123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.47 MySQL Community Server (GPL)


Copyright (c) 2000, 2015, 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> 
至此简单的用rpm包来安装mysql就完成了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值