0112centos上面l安装卸载mysq
http://www.centoscn.com/CentosServer/sql/2015/0409/5127.html
常用命令
cat /etc/issue
rpm -qa | grep mysql
yum -y remove mysql-libs-5.1*
rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
/usr/bin/mysql_install_db
ps -ef | grep mysql
chkconfig mysql on
chkconfig mysql --list
忘记mysql密码,CentOS下设置Mysql的root密码
/etc/init.d/mysql stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
FLUSH PRIVILEGES;
exit;
/etc/init.d/mysql restart
如何确定mysql使用哪个配置文件
mysql --help | grep 'Default options' -A 1
按照上面顺序一样,mysql会依序的去这些位置找my.cnf文件的,没有就下一个。
whereis my.cnf可以查看哪些地方有该文件
开启mysql 3306访问端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables status
即可 -- 卸载mysql
1: 检查是否安装了MySQL组件。
[root@DB-Server init.d]# rpm -qa | grep -i mysql
MySQL-devel-5.6.23-1.linux_glibc2.5
MySQL-client-5.6.23-1.linux_glibc2.5
MySQL-server-5.6.23-1.linux_glibc2.5
如上所示,说明安装了MySQL 5.6.23这个版本的client、server、devel三个组件。
2: 卸载前关闭MySQL服务
2.1 方法1
[root@DB-Server init.d]# service mysql status
MySQL running (25673)[ OK ]
[root@DB-Server init.d]# service mysql stop
Shutting down MySQL..[ OK ]
[root@DB-Server init.d]# service mysql status
MySQL is not running[FAILED]
2.2 方法2
[root@DB-Server init.d]# ./mysql status
MySQL running (26215)[ OK ]
[root@DB-Server init.d]# ./mysql stop
Shutting down MySQL..[ OK ]
[root@DB-Server init.d]# ./mysql status
MySQL is not running[FAILED]
[root@DB-Server init.d]#
[root@DB-Server init.d]# chkconfig --list | grep -i mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@DB-Server init.d]#
3. 收集MySQL对应的文件夹信息
[root@DB-Server init.d]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
最好实用find命令查看MySQL数据库相关的文件,方便后面彻底删除MySQL。
[root@DB-Server init.d]# find / -name mysql
/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql
/var/lock/subsys/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/include/mysql
/usr/include/mysql/mysql
/usr/bin/mysql
/usr/share/mysql
/usr/lib64/mysql
4: 卸载删除MySQL各类组件
[root@DB-Server init.d]#
[root@DB-Server init.d]# rpm -ev MySQL-devel-5.6.23-1.linux_glibc2.5
[root@DB-Server init.d]# rpm -ev MySQL-server-5.6.23-1.linux_glibc2.5
You have new mail in /var/spool/mail/root
[root@DB-Server init.d]# rpm -ev MySQL-client-5.6.23-1.linux_glibc2.5
[root@DB-Server init.d]#
5:删除MySQL对应的文件夹
检查各个MySQL文件夹是否清理删除干净。
[root@DB-Server init.d]# whereis mysql
mysql:
[root@DB-Server init.d]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
[root@DB-Server init.d]# rm -rf /var/lib/mysql
[root@DB-Server init.d]# rm -rf /var/lib/mysql/mysql
[root@DB-Server init.d]# rm -rf /usr/lib64/mysql
[root@DB-Server init.d]#
6:删除mysql用户及用户组
如果有必要,删除mysql用户以及mysql用户组。
[root@DB-Server ~]# more /etc/passwd | grep mysql
mysql:x:101:501::/home/mysql:/bin/bash
[root@DB-Server ~]# more /etc/shadow | grep mysql
mysql:!!:16496::::::
[root@DB-Server ~]# more /etc/group | grep mysql
mysql:x:501:
[root@DB-Server ~]# userdel mysql
[root@DB-Server ~]# groupdel mysql
groupdel: group mysql does not exist
[root@DB-Server ~]#
7:确认MySQL是否卸载删除
[root@DB-Server init.d]# rpm -qa | grep -i mysql
-- 转自http://www.cnblogs.com/kerrycode/p/4364465.html
0112centos上面l安装卸载mysq的更多相关文章
- 帮同事写了几行代码,在 安装/卸载 程序里 注册/卸载 OCX控件
写了个小控制台程序,这个程序用来注册 / 卸载OCX控件,用在Inno Setup做的安装卸载程序里. #include "stdafx.h" #include <windo ...
- Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令
Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...
- Linux 之【辨析UPDATE/UPGRADE】和安装/卸载软件(apt-get)
一.[辨析UPDATE/UPGRADE] UPDATE: update is used to download package information from all configured sour ...
- debian下使用dpkg来安装/卸载deb包 (转载)
转自:http://blog.csdn.net/zhou_2008/article/details/6076900 在debian下,你可以使用dpkg(Debian package system)来 ...
- inno安装卸载时检测程序是否正在运行卸载完成后自动打开网页-代码无效
inno安装卸载时检测程序是否正在运行卸载完成后自动打开网页-代码无效 inno setup 安装卸载时检测程序是佛正在运行卸载完成后自动打开网页-代码无效 --------------------- ...
- Windows Service的安装卸载 和 Service控制(转)
Windows Service的安装卸载 和 Service控制 原文地址:http://www.cnblogs.com/Peter-Zhang/archive/2011/10/15/2212663. ...
- 15个Linux Yum命令实例--安装/卸载/更新
在linux环境中, 安装, 卸载更新包是一个极为常见的操作.大部分的linux环境都提供了包的管理工具, 例如:apt-get, dpkg, rpm, yum等等. 一些Linux环境中,yum是默 ...
- Delphi安装/卸载OCX控件的方法
delphi 安装卸载ocx 请参见 如下 http://blog.csdn.net/xt_chaoji/article/details/7027298 打开Delphi,关闭所有项目. 1. ...
- WPF 自己动手来做安装卸载程序
原文:WPF 自己动手来做安装卸载程序 前言 说起安装程序,这也许是大家比较遗忘的部分,那么做C/S是小伙伴们,难道你们的程序真的不需要一个炫酷的安装程序么? 声明在先 本文旨在教大家以自己的方式实现 ...
随机推荐
- mysql查询count
Every derived table must have its own alias 每个派生出来的表都必须有一个自己的别名 一般在多表查询时,会出现此错误. 因为,进行嵌套查询的时候子查询出来的的 ...
- 科普:alphago是什么
鉴于大部分人类对alphago的认识: 1:Alphago有什么了不起的?不就是算得快吗.ibm早在20年前就通过象棋战胜人类了.又是Google的一次营销. 2:alphago 实现人工智能了,电脑 ...
- Nginx中的root&alias文件路径及索引目录配置详解
这篇文章主要介绍了Nginx中的root&alias文件路径及索引目录配置,顺带讲解了root和alias命令的用法,需要的朋友可以参考下 root&alias文件路径配置ng ...
- 杂项:Kafka
ylbtech-杂项:Kafka Kafka是由Apache软件基金会开发的一个开源流处理平台,由Scala和Java编写.Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站 ...
- 使用串口终端安装AIX操作系统
使用串口终端安装AIX操作系统 一.配置超级终端 首先,配置超级终端:在笔记本电脑上(Windows XP系统),点击开始à程序->附件->通讯->超级终端,配置名称为test的超级 ...
- [Oracle] Oracle终极解锁
一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库.现在提供一种方法解决这种问题,那就是在ORACLE中杀不 ...
- Java中Calendar(日历)相关API举例
Java中Calendar(日历)相关API举例,实现功能:输入一个年份和月份打印出这个月的日历. package calendarPrint; import java.util.Calendar; ...
- IO编程 - 转载自廖雪峰的博文
IO在计算机中指Input/Output,也就是输入和输出.由于程序和运行时数据是在内存中驻留,由CPU这个超快的计算核心来执行,涉及到数据交换的地方,通常是磁盘.网络等,就需要IO接口. 比如你打开 ...
- [XJOI]noip44 T3还有这种操作
还有这种操作 ttt 最近在学习二进制, 他想知道小于等于N的数中有多少个数的二进制表示中有偶数个1. 但是他想了想觉得不够dark,于是他增加了若干次操作,每次操作会将一个区间内的0变1 , 1变0 ...
- springmvc-servlet.xml(springmvc-servlet.xml 配置 增强配置)
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...