CentOS6.7+Mysql5.5.54的rpm安装步骤

    本次安装Mysql使用的是rpm安装包,可在官网下载。

    本文有参考:http://blog.csdn.net/cheney1993/article/details/55254868中的内容,十分感谢。


    mysql: MySQL-5.5.54-1.linux2.6.x86_64
    linux:CentOS6.7
    虚拟机:VMWare12

切换到root用户下

    1、首先运行一下两行代码安装必要的依赖,我第一次没有这样做,后续安装会提示缺少perl的依赖等信息

yum -y install gcc gcc-c++ gdb
yum install libtool

    2、将下载好的rpm包上传到linux中(自定义目录,我是上传到/usr/local/mysql/中),然后解压

tar -xvf  MySQL-5.5.54-1.linux2.6.x86_64.rpm-bundle.tar

    然后目录下会出现很多个rpm包,但是我们需要的就三个
这里写图片描述

    3、依次安装

rpm -ivh MySQL-client-5.5.54-1.linux2.6.x86_64.rpm

    报错如下:

[root@mini01 soft]# rpm -ivh MySQL-client-5.5.54-1.linux2.6.x86_64.rpm
warning: MySQL-client-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
    file /usr/bin/msql2mysql from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysql from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysql_find_rows from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysql_waitpid from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlaccess from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqladmin from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlbinlog from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlcheck from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqldump from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlimport from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlshow from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/bin/mysqlslap from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysql.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysql_find_rows.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysql_waitpid.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysqlaccess.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysqladmin.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysqldump.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysqlshow.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64
    file /usr/share/man/man1/mysqlslap.1.gz from install of MySQL-client-5.5.54-1.linux2.6.x86_64 conflicts with file from package mysql-5.1.73-8.el6_8.x86_64

    可发现mysql-5.1.73-8.el6_8.x86_64包下的内容冲突较多,直接删除冲突的包

[root@mini01 soft]# rpm -e mysql-5.1.73-8.el6_8.x86_64

    重新安装

[root@mini01 soft]# rpm -ivh MySQL-client-5.5.54-1.linux2.6.x86_64.rpm
warning: MySQL-client-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]

    4、安装 MySQL-devel-5.5.54-1.linux2.6.x86_64.rpm 成功

[root@mini01 soft]# rpm -ivh MySQL-devel-5.5.54-1.linux2.6.x86_64.rpm
warning: MySQL-devel-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]

    5、安装 MySQL-server-5.5.54-1.linux2.6.x86_64.rpm

[root@mini01 soft]# rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm
warning: MySQL-server-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    libaio.so.1()(64bit) is needed by MySQL-server-5.5.54-1.linux2.6.x86_64
    libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.54-1.linux2.6.x86_64
    libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.54-1.linux2.6.x86_64

    这里提示缺少了libaio.so.1的依赖,要先安装上它。从网上下载了后上传至linux下,安装libaio

[root@mini01 soft]# rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm

    重新安装

[root@mini01 soft]# rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm
warning: MySQL-server-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]

    6、可查看mysql的状态

service mysql status

    7、进入到/usr/bin/目录下,使用mysql_secure_installation初始化mysql的信息。大致情况如下

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Sorry, passwords do not match.

New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]  n
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

然后就可以启动mysql了

[root@mini01 ~]# mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.54 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

祈祷,仙女不会有BUG

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值