版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/macfac/article/details/51868712
 0. 到官网下载好,想要安装的rpm包,本人使用的是
MySQL-server-5.5.50-1.linux2.6.x86_64.rpm  和 MySQL-client-5.5.50-1.linux2.6.x86_64.rpm
下载完之后可以放在/usr/local/mysql 里(个人习惯,只要找的到就行)
1.查看系统是否有安装过的rpm包
      rpm -qa | grep -i mysql
2.查看CentOS自带mysql是否已安装。
yum list installed | grep mysql
3.卸载所有安装
    yum -y remove mysql-libs*(删除mysql-libs开头的所以安装文件,如有其他文件可直接更换文件名进行删除)

4.删除其他文件(如果没有不用操作)

rm -rf /var/lib/mysql*
rm -rf /usr/share/mysql*

5.删除其他文件

卸载后 /etc/my.cnf 会重命名为 my.cnf.rpmsave,/var/log/mysqld.log 会重命名为 /var/log/mysqld.log.rpmsave,删除两个文件
6.安装服务端

rpm -ivh MySQL-server-5.5.50-1.linux2.6.x86_64.rpm (执行此命令要到MySQL-server-5.5.50-1.linux2.6.x86_64.rpm所在目录)
以下是成功日志内容:
Preparing... ########################################### [100%] 
1:MySQL-server ########################################### [100%] 
warning: user mysql does not exist - using root 
warning: group mysql does not exist - using root 
2014-08-10 22:43:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2014-08-10 22:43:44 23012 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2014-08-10 22:43:44 23012 [Note] InnoDB: The InnoDB memory heap is disabled 
2014-08-10 22:43:44 23012 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2014-08-10 22:43:44 23012 [Note] InnoDB: Memory barrier is not used 
2014-08-10 22:43:44 23012 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2014-08-10 22:43:44 23012 [Note] InnoDB: Using Linux native AIO 
2014-08-10 22:43:44 23012 [Note] InnoDB: Not using CPU crc32 instructions 
2014-08-10 22:43:44 23012 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2014-08-10 22:43:44 23012 [Note] InnoDB: Completed initialization of buffer pool 
2014-08-10 22:43:45 23012 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 
2014-08-10 22:43:45 23012 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 
2014-08-10 22:43:45 23012 [Note] InnoDB: Database physically writes the file full: wait... 
2014-08-10 22:43:45 23012 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 
2014-08-10 22:43:46 23012 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 
2014-08-10 22:43:46 23012 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 
2014-08-10 22:43:46 23012 [Warning] InnoDB: New log files created, LSN=45781 
2014-08-10 22:43:46 23012 [Note] InnoDB: Doublewrite buffer not found: creating new 
2014-08-10 22:43:46 23012 [Note] InnoDB: Doublewrite buffer created 
2014-08-10 22:43:46 23012 [Note] InnoDB: 128 rollback segment(s) are active. 
2014-08-10 22:43:46 23012 [Warning] InnoDB: Creating foreign key constraint system tables. 
2014-08-10 22:43:47 23012 [Note] InnoDB: Foreign key constraint system tables created 
2014-08-10 22:43:47 23012 [Note] InnoDB: Creating tablespace and datafile system tables. 
2014-08-10 22:43:47 23012 [Note] InnoDB: Tablespace and datafile system tables created. 
2014-08-10 22:43:47 23012 [Note] InnoDB: Waiting for purge to start 
2014-08-10 22:43:47 23012 [Note] InnoDB: 5.6.22 started; log sequence number 0 
A random root password has been set. You will find it in '/root/.mysql_secret'. 
2014-08-10 22:43:48 23012 [Note] Binlog end 
2014-08-10 22:43:48 23012 [Note] InnoDB: FTS optimize thread exiting. 
2014-08-10 22:43:48 23012 [Note] InnoDB: Starting shutdown... 
2014-08-10 22:43:50 23012 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2014-08-10 22:43:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2014-08-10 22:43:50 23039 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2014-08-10 22:43:50 23039 [Note] InnoDB: The InnoDB memory heap is disabled 
2014-08-10 22:43:50 23039 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2014-08-10 22:43:50 23039 [Note] InnoDB: Memory barrier is not used 
2014-08-10 22:43:50 23039 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2014-08-10 22:43:50 23039 [Note] InnoDB: Using Linux native AIO 
2014-08-10 22:43:50 23039 [Note] InnoDB: Not using CPU crc32 instructions 
2014-08-10 22:43:50 23039 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2014-08-10 22:43:50 23039 [Note] InnoDB: Completed initialization of buffer pool 
2014-08-10 22:43:50 23039 [Note] InnoDB: Highest supported file format is Barracuda. 
2014-08-10 22:43:50 23039 [Note] InnoDB: 128 rollback segment(s) are active. 
2014-08-10 22:43:50 23039 [Note] InnoDB: Waiting for purge to start 
2014-08-10 22:43:50 23039 [Note] InnoDB: 5.6.22 started; log sequence number 1625977 
2014-08-10 22:43:50 23039 [Note] Binlog end 
2014-08-10 22:43:50 23039 [Note] InnoDB: FTS optimize thread exiting. 
2014-08-10 22:43:50 23039 [Note] InnoDB: Starting shutdown... 
2014-08-10 22:43:52 23039 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! 
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect, 
no other statement but 'SET PASSWORD' will be accepted. 
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database. 
This is strongly recommended for production servers.

See the manual for more instructions.

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

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and 
will be used by default by the server when you start it. 
You may edit this file to change server settings

7.启动服务

service mysql start
以下是成功日志:
Starting MySQL.......... SUCCESS!

8.安装客户端

rpm -ivh MySQL-client-5.5.50-1.linux2.6.x86_64.rpm(执行此命令要在MySQL-client-5.5.50-1.linux2.6.x86_64.rpm所在目录)
以下是成功日志
Preparing...                ########################################### [100%]
1:MySQL-client           ^C########################################### [100%]   安装完成

9.文件配置

找到my.cnf配置文件
如果"/etc/"目录下没有my.cnf配置文件,请到 "/usr/share/mysql/" 下找到 my-default.cnf  文件,拷贝其中一个合适的配置文件到 "/etc/" 并改名为 "my.cnf" 中。命令如下:
cp /usr/share/mysql/my-medium.cnf  /etc/my.cnf

10.修改上一步拷贝的my.cnf文件(配置/etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码utf-8.)
[client]  
password        = 123456  
port            = 3306  
default-character-set=utf8  
[mysqld]  
port            = 3306  
character_set_server=utf8  
character_set_client=utf8  
collation-server=utf8_general_ci  
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)  
lower_case_table_names=1  
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )  
max_connections=1000  
[mysql]  
default-character-set = utf8

11.设置Mysql开机启动
chkconfig mysqld on

12.开启3306端口并保存
1./sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
2./etc/rc.d/init.d/iptables save
13.连接mysql数据库
mysql -uroot -p 
此时会提示你输入密码,直接enter 键;
14.修改mysql密码
1.update user set password=password('密码') where user='root';
2.flush privileges;
15.设置Mysql远程访问
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
其中123456是你设置的远程连接密码。
16.. MySQL的默认rpm安装位置
1
/var/lib/mysql/               #数据库目录
2
/usr/share/mysql              #配置文件目录
3
/usr/bin                     #相关命令目录
4
/etc/init.d/mysql              #启动脚本

---------------------
作者:Y_JY
来源:CSDN
原文:https://blog.csdn.net/macfac/article/details/51868712
版权声明:本文为博主原创文章,转载请附上博文链接!

Centos6 rpm 安装mysql5.5(转)的更多相关文章

  1. CentOS6.5安装MySQL5.6

    CentOS6.5安装MySQL5.6,开放防火墙3306端口,允许其他主机使用root账户密码访问MySQL数据库 查看操作系统相关信息 ** 该查看方法只适用于CentOS6.5 (lsb_rel ...

  2. centos6.5安装Mysql5.6及更改密码

    (一) centos6.5安装Mysql5.6 二进制文件安装的方法分为两种: 第一种是不针对特定平台的通用安装方法,使用的二进制文件是后缀为.tar.gz的压缩文件: 第二种是使用RPM或其他包进行 ...

  3. Centos6.5安装MySQL5.6备忘记录

    Centos6.5安装MySQL5.6 1. 查看系统状态 [root@itzhouq32 tools]# cat /etc/issue CentOS release 6.5 (Final) Kern ...

  4. CentOS6.5安装mysql5.7

    CentOS6.5安装mysql5.7 查看mysql的安装路径: [root@bogon ~]# whereis mysql mysql: /usr/bin/mysql /usr/lib/mysql ...

  5. 第三百九十九节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署CentOS6.5安装mysql5.6

    第三百九十九节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署CentOS6.5安装mysql5.6 1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步 ...

  6. centos6.8安装mysql5.6【转】

    首先先要去看看本机有没有默认的mysql, 本地默认有的,我们应先卸载,在安装新的这个逻辑. rpm -qa | grep mysql 我本机默认安装的mysql5.1.73 下一步删除 rpm -e ...

  7. linux 环境RPM 安装MYSQL5.6

    linux 环境RPM 安装MYSQL5.6 系统环境 CentOS7.2 1.关闭selinux 服务[SELinux是一种基于域-类型 模型(domain-type)的强制访问控制(MAC)安全系 ...

  8. RPM安装MYSQL5.7

    RPM安装MYSQL5.7 1:YUM安装依赖库 yum install perl libaio numactl 2:下载安装需要的RPM包 https://dev.mysql.com/get/Dow ...

  9. RPM安装MySQL5.7并更改数据目录

    RPM安装MySQL5.7并更改数据目录 文末附MySQL完整配置文件 官网地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads 注意 ...

随机推荐

  1. mysql 转义字符问题

    首先我们要知道,数据库都是由表构成的,当你把数据插入到其中的一个表中的时候,比如是数字呀.文字呀等等的插入的时候能正常插入,但是一旦你要插入特殊的字符,比如说插入下面这个括号里面的内容(“ABC”)到 ...

  2. REST easy with kbmMW #16 – Multiple servers using HTTP.sys transport

    前文写过使用HTTP.sys转输层(TkbmMWHTTPSysServerTransport),实现一个kbmMW应用服务器. 如果在一台服务器上,同时运行多个,基于TkbmMWHTTPSysServ ...

  3. Python socket简单操作

    #服务端:#导入socket模块 import socket #创建socket对象,创建了一个手机 server = socket.socket() #给程序设置一个ip地址和端口号,买了个手机卡 ...

  4. nodejs环境下配置运行mysql

    首先需要在本地运行node环境   必须在本地安装mysql(可以用xampp里面的) 在node环境下引入mysql模块   命令: npm install node-mysql 运用例子(前提条件 ...

  5. xshell 评估过期

    手头拮据的朋友可以通过下面方法绕过: https://www.netsarang.com/download/down_form.html?code=522 删除XShell. 到英文官网下载页找到XS ...

  6. Visio 安装

    网上下载了光盘镜像文件,点击setup 安装,但是弹出来说少了文件,,msxml6,,,什么一大串,, 在网上下载了一个文件,,就可以用了,,,MicrosoftFixit50927.msi

  7. python base64 编解码,转换成Opencv,PIL.Image图片格式

    二进制打开图片文件,base64编解码,转成Opencv格式: # coding: utf-8 import base64 import numpy as np import cv2 img_file ...

  8. Web form ajax请求

    1.添加web应用程序 2.添加web窗体 web窗体Demo <%@ Page Language="C#" AutoEventWireup="true" ...

  9. 错题:Test3

    /** * * @ClassName: test3 * @Description: TODO(请问主程序运行结果是什么?) * @author yk * @date 2017年3月9日 上午11:20 ...

  10. 并发编程-TPL

    并发编程-TPL 本节导航 基本概念 并发编程 TPL 线程基础 windows为什么要支持线程 线程开销 CPU的发展 使用线程的理由 如何写一个简单Parallel.For循环 数据并行 Para ...