Linux下MySQL强制卸载过程及安装

针对Linux已存在MySQL而无法安装的情况,我们可以进行强制卸载,再进行安装,步骤:
   1. 查找已安装的myslq 版本:
       #rpm -q mysql
        在屏幕上将显示已安装的mysql包名如:mysql-5.0.77-4.el5_5.3
       如果通过该命令,提示没有安装mysql,而你确定已安装,可以使用下面命令,尝试一下:
       #rpm -qa | grep -i mysql
         MySQL-server-5.5.11-1.rhel5
    2. 强制卸载(将要卸载的必须是上面查询到的mysql的全称包括版本号,此处是在无法正常卸载时不得已的操作,强制卸载,必须用参数--nodeps):
        #rpm -e --nodeps mysql-5.0.77-4.el5_5.3
    3.成功卸载,系统不提示任何信息,接下来,安装MySQL:
        #rpm -ivh MySQL-server-5.5.9-1.linux2.6.i386.rpm
     4.安装完成,会提示你不要忘记设计root用户的密码及其他信息:
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.

你可能感兴趣的:(mysql,linux)