图片 3

MYSQL服务卸除总结,MYSQL服务安装总结

MYSQL服务卸除总结

MYSQL服务安装总结

1、使用以下命令查看当前安装mysql情况

rpm -qa | grep -i mysql

图片 1

image.png

 

 

1.1使用rpm -e命令进行卸载

rpm -e MySQL-devel-5.6.35-1.el6.x86_64
MySQL-client-5.6.35-1.el6.x86_64 MySQL-server-5.6.35-1.el6.x86_64

系统环境信息

系统环境信息  www.2cto.com  

1.2使用yum remove命令进行删除

yum remove mysql mysql-server mysql-libs

图片 2

image.png

1 CentOS release 6.3 (Final)

CentOS release 6.3 (Final)

1.3使用find命令查找所有的mysql目录,然后使用rm命令删除

find / -name mysql

图片 3

image.png

2 VMware® Workstation 9.0.0 build-812388

VMware® Workstation 9.0.0 build-812388

2、停止mysql服务、删除之前安装的mysql

删除命令:rpm -e –nodeps 包名

rpm -ev MySQL-client-5.5.25a-1.rhel5
rpm -ev MySQL-server-5.5.25a-1.rhel5

   www.2cto.com  

rpm安装包准备

2.1如果提示依赖包错误,则使用以下命令尝试

rpm -ev MySQL-client-5.5.25a-1.rhel5 –nodeps

MYSQL卸除

      1 从光盘拷贝如下安装包到指定目录

2.2如果提示错误:error: %preun(xxxxxx) scriptlet failed, exit status 1

则用以下命令尝试:

rpm -e –noscripts MySQL-client-5.5.25a-1.rhel5

1 查看历史安装信息

      2 也可以从RPM资源网站下载到本地环境

2.3使用yum remove 删除

[root@data lib]# rpm -qa¦grep mysql
mysql-5.5.25-1.el6.remi.i686
mysql-libs-5.5.25-1.el6.remi.i686
compat-mysql51-5.1.54-1.el6.remi.i686
mysql-server-5.5.25-1.el6.remi.i686
[root@data lib]# yum remove mysql mysql-server mysql-libs
compat-mysql51

#rpm -qa |grep -i mysql

         

3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库

find / -name mysql

或者使用

whereis mysql

查找结果如下:

/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql

删除对应的mysql目录

rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql

查找目录并删除

注意:卸载后/etc/my.cnf不会删除,需要进行手工删除

rm -rf /etc/my.cnf

mysql-libs-5.1.61-4.el6.i686

perl-DBI-1.609-4.el6.i686.rpm

4、 删除可能还在运行的mysql进程——这是最容易忽略的地方

可以用ps -ef | grep mysql查看下,多于一个时把他们全部kill掉。

ps -ef |grep mysql

否则会在你安装server的rpm包的时候报启动错误,我的报错最后两行如下:

Starting MySQL..Manager of pid-file quit without updating
file.[失败]
Giving mysqld 2 seconds to start.

mysql-server-5.1.61-4.el6.i686

mysql-libs-5.1.61-4.el6.i686.rpm

5、再次查找机器是否安装mysql

无结果,说明已经卸载彻底

mysql-5.1.61-4.el6.i686

mysql-5.1.61-4.el6.i686.rpm

 

perl-DBD-MySQL-4.013-3.el6.i686.rpm

2 卸除MYSQL

mysql-server-5.1.61-4.el6.i686.rpm

#rpm -ev –nodeps mysql-libs-5.1.61-4.el6.i686

      目录名称

#rpm -ev –nodeps mysql-server-5.1.61-4.el6.i686

/usr/dev/mysql

#rpm -ev –nodeps mysql-5.1.61-4.el6.i686

卸除原有MYSQL服务
 

3 删除其他MYSQL开发文件和库 日志以及配置文件

     参见MYSQL服务卸除文章

 

#whereis mysql

操作步骤

mysql: /usr/lib/mysql /usr/share/mysql

#cd /usr/dev

#rm -rf /usr/lib/mysql

#rpm -ivh perl-DBI-1.609-4.el6.i686.rpm

#rm -rf /usr/share/mysql

#rpm -ivh mysql-libs-5.1.61-4.el6.i686.rpm

 

#rpm -ivh mysql-5.1.61-4.el6.i686.rpm

系统环境信息 1 CentOS release
6.3 (Final) 2 VMware Workstation 9.0.0 build-812388 www.2cto.com
MYSQL卸除 1 查看历史安装信息 #rpm -qa |grep -…

#rpm -ivh perl-DBD-MySQL-4.013-3.el6.i686.rpm

#rpm -ivh mysql-server-5.1.61-4.el6.i686.rpm

#/usr/bin/mysql_install_db –user=mysql  

#/usr/bin/mysqld_safe &

#/etc/init.d/mysqld status

备注

 命令7含义 初始化MYSQL数据库 该命令用来初始化
mysql数据库,即创建/var/lib/mysql目录

 命令8含义 启动MYSQL服务

 命令9含义 查看MYSQL启动状态

 

执行命令7后显示如下信息

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

Installing MySQL system tables…

OK

Filling help tables…

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

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 localhost.localdomain 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.

 

You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /usr/bin/mysqlbug script!

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

执行命令8后显示如下信息

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

mysqld_safe Logging to ‘/var/log/mysqld.log’.                        

mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

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

执行命令9后显示如下信息

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

mysqld (pid  4200) is running…

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

 

系统环境信息 www.2cto.com
CentOS release 6.3 (Final) VMware Workstation 9.0.0 build-812388
rpm安装包准备 1 从光盘拷贝如下安装包到指定目…