1.首先查看Linux有没有装MySQL输入命令 rpm -qa|grep -i mysql 如下图
如果没有安装MySQL的话是不会出现下面的两行,由于我的系统是刚刚安装好的,所以输入命令就可以看到已安装的信息
2.如果没有安装则去官网下载MySQL的服务端和客户端,这里我就不介绍怎么下载了
下载MySQL的rpm服务端和客户端的安装文件,放到Linux 的opt目录下
cd /opt 进入opt目录,然后输入下面命令,先装服务端
rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm(64位操作系统)
rpm -ivh MySQL-server-5.5.48-1.linux2.6.i386.rpm( 32位操作系统 )
注意:如果这里执行命令报错如下错:
error: Failed dependencies:
libaio.so.1 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libaio.so.1(LIBAIO_0.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libaio.so.1(LIBAIO_0.4) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.0) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.1.2) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.1.3) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.2) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.2.3) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.3) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libc.so.6(GLIBC_2.3.3) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libcrypt.so.1 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libcrypt.so.1(GLIBC_2.0) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libdl.so.2 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libdl.so.2(GLIBC_2.0) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libdl.so.2(GLIBC_2.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libm.so.6 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libm.so.6(GLIBC_2.0) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libm.so.6(GLIBC_2.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libpthread.so.0 is needed by MySQL-server-5.5.48-1.linux2.6.i386
libpthread.so.0(GLIBC_2.0) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libpthread.so.0(GLIBC_2.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libpthread.so.0(GLIBC_2.2) is needed by MySQL-server-5.5.48-1.linux2.6.i386
libpthread.so.0(GLIBC_2.3.2) is needed by MySQL-server-5.5.48-1.linux2.6.i386
librt.so.1 is needed by MySQL-server-5.5.48-1.linux2.6.i386
librt.so.1(GLIBC_2.2) is needed by MySQL-server-5.5.48-1.linux2.6.i386
报这种错误,说明你的操作系统是64位的,却装了32位的MySQL,那么需要重新下载64位的MySQL,不下载直接用命令rpm -ivh MySQL-server-5.5.48-1.linux2.6.i386.rpm --force --nodeps强制装的话,启动不了MySQL的,所以一定要安装版本相同的
4.如果真的不小心使用了上述命令,在64位操作系统装了32位的MySQL,卸载又卸载不干净,装新的64位MySQL的时候报如下错
Preparing... ################################# [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.5.54-1.linux2.6.x86_64 conflicts with file from package mariadb-libs-1:5.5.52-1.el7.x86_64
那么接下来执行yum list | grep mysql,查看冲突的包, 如下图:
再执行yum remove mysql-libs即可
5.客户端也是一样的安装,安装以后可以进行查看是否安装成功,输入命令
cat /etc/passwd|grep mysql
出现MySQL的用户组,则说明安装成功
或者输入mysqladmin --version
网友评论