1.下载

https://dev.mysql.com/downloads/mysql/5.5.html#downloads下载

MySQL-server-5.5.61-1.el6.x86_64.rpm

MySQL-client-5.5.61-1.el6.x86_64.rpm

2.安装

rpm -ivh MySQL-server-5.5.61-1.el6.x86_64.rpm

警告:MySQL-server-5.5.61-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
        file /usr/share/mysql/charsets/README from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
        file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64

.............

file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
        file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
        file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
        file /usr/bin/my_print_defaults from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-1:5.5.60-1.el7_5.x86_64
        file /usr/share/man/man1/my_print_defaults.1.gz from install of MySQL-server-5.5.61-1.el6.x86_64 conflicts with file from package mariadb-1:5.5.60-1.el7_5.x86_64
[root@centos7 ~]# rpm -e mariadb-libs-1:5.5.60-1.el7_5.x86_64
错误:依赖检测失败:
        libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
        libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
        mariadb-libs(x86-64) = 1:5.5.60-1.el7_5 被 (已安裝) mariadb-1:5.5.60-1.el7_5.x86_64 需要

检测到冲突

有冲突,删除冲突:

[root@centos7 ~]# rpm -e mariadb-libs-1:5.5.60-1.el7_5.x86_64 --nodeps

[root@centos7 ~]# rpm -e mariadb-1:5.5.60-1.el7_5.x86_64 --nodeps

解决冲突后,再次安装

[root@centos7 ~]# rpm -ivh MySQL-server-5.5.61-1.el6.x86_64.rpm
警告:MySQL-server-5.5.61-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:MySQL-server-5.5.61-1.el6        ################################# [100%]
警告:用户mysql 不存在 - 使用root
警告:群组mysql 不存在 - 使用root
181004 19:52:05 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181004 19:52:05 [Note] /usr/sbin/mysqld (mysqld 5.5.61) starting as process 1493 ...
181004 19:52:05 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181004 19:52:05 [Note] /usr/sbin/mysqld (mysqld 5.5.61) starting as process 1500 ...

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 centos7.tk.com 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.

Please report any problems at http://bugs.mysql.com/

查看mysql是否启动     ([root@centos7 ~]# netstat -nltp   查看网络端口)

[root@centos7 ~]# netstat -nltp   查看网络端口
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1000/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1118/master         
tcp6       0      0 :::22                   :::*                    LISTEN      1000/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1118/master

没有启动

启动mysql

[root@centos7 ~]# service mysql start

Starting MySQL... SUCCESS!
[root@centos7 ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1632/mysqld
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1000/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1118/master
tcp6       0      0 :::22                   :::*                    LISTEN      1000/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1118/master

已启动  看到3306端口,启动成功

更改密码,报没有安装client

[root@centos7 ~]# /usr/bin/mysql_secure_installation
Can't find a 'mysql' client in PATH or ./bin

安装client

[root@centos7 ~]# rpm -ivh MySQL-client-5.5.61-1.el6.x86_64.rpm
警告:MySQL-client-5.5.61-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:MySQL-client-5.5.61-1.el6        ################################# [100%]

client 安装成功,继续修改密码

[root@centos7 ~]# /usr/bin/mysql_secure_installation




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  敲y
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
 ... skipping.

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!

登陆验证

[root@centos7 ~]# mysql -u root -p root
Enter password:
ERROR 1049 (42000): Unknown database 'root'
[root@centos7 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.61 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+

安装完成,大功告成!!!

10-04 20:23