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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章