RedHat下安装MySQL5.5

MYSQL在windows下面安装可能一帆风顺,但是如果真的到纯图形界面的redhat服务器上,可能就不是那么容易了,这里我就详细的介绍一下MYSQL5.5在linux下的安装以及注意的问题,避免后来人犯错。

工具/原料

   linux - Redhat

   MySQL-5.5.39-2.el6.x86_64.rpm-bundle.tar

   shell控制台

 

方法/步骤

   下载mysql5.5的安装包。这里下载的是MySQL-5.5.39-2.el6.x86_64.rpm-bundle.tar

   解压mysql5.5的安装包

   tar -xvf MySQL-5.5.39-2.el6.x86_64.rpm-bundle.tar

   注意的是要切换的root用户  使用 su root切换用户

   解压之后就是出现了好多的rpm文件

在这些文件中我们要安装的就是下面的3个,这个地方注意了。

MySQL-client-5.5.39-2.el6.x86_64.rpm

MySQL-devel-5.5.39-2.el6.x86_64.rpm

MySQL-server-5.5.39-2.el6.x86_64.rpm

安装过程较快,除了MySQL-server-5.5.39-2.el6.x86_64.rpm稍微慢一些。

其他两个十分的快

使用的命令是

rpm - ivh   *.rpm



这里我们看到安装MySQL-server-5.5.39-2.el6.x86_64.rpm时没有错误,但是如果linux系统默认自带了较低版本的mysql,那么此时就会报错,类似如下错误信息:

Preparing...                ########################################### [100%]
        file /usr/share/mysql/charsets/README from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64
        file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64

        file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.5.24-1.linux2.6.x86_64 conflicts with file from package mysql-libs-5.1.61-1.el6_2.1.x86_64

原因是系统已经安装了其他版本的mysql-libs包导致不兼容。

删除mysql-libs

[root@localhost ~]# yum remove mysql-libs

执行成功之后,再次安装MySQL-server-5.5.39-2.el6.x86_64.rpm就ok了。

 

接着就是初始化数据库。十分简单 /usr/bin/mysql_install_db

接下来就是查看mysql的状态,并设置mysql的初始密码,见下图。

好了,5步下来我们的mysql就安装完毕。是不是很简单啊。哈哈



但是我们有时候在执行service mysql status时候会提示mysql服务没有启动,那么我们手动启动一下mysql:

service mysql start(停止mysql服务的命令service mysql stop)。

至此,rehat下安装mysql5.5已经完毕。

 

猜你喜欢

转载自javawangbaofeng.iteye.com/blog/2243198