一、卸载自带mysql,删除MySQL的lib库,服务文件

[root@localhost ~]#rpm -qa|grep mysql
qt-mysql-4.6.2-26.el6_4.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64

[root@localhost ~]# rpm -e --nodeps qt-mysql-4.6.2-26.el6_4.x86_64
[root@localhost ~]# rpm -e --nodeps mysql-5.1.71-1.el6.x86_64
[root@localhost ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
[root@localhost ~]# rpm -e --nodeps mysql-devel-5.1.71-1.el6.x86_64
[root@localhost ~]# rpm -e --nodeps mysql-server-5.1.71-1.el6.x86_64
[root@localhost ~]# rpm -qa|grep mysql
[root@localhost ~]#

清除所有mysql相关文件:
[root@localhost ~]#find / -name mysql
/usr/lib64/perl5/DBD/mysql
/usr/lib64/perl5/auto/DBD/mysql
/usr/share/mysql

[root@localhost ~]#rm –rf /usr/lib64/perl5/DBD/mysql
[root@localhost ~]#rm –rf /usr/lib64/perl5/auto/DBD/mysql
[root@localhost ~]#rm –rf /usr/share/mysql

查看是否有残留文件:
[root@localhost ~]#rpm -qa | grep mysql

二、安装MySQL

1.复制mysql安装包到安装目录

准备源码包:MySQL-5.6.36-1.linux_glibc2.5.i386.rpm-bundle.tar
将源码包以二进制方式上传到/usr/appsoft/software目录下

2.解压安装包

[root@localhost ~]cd /usr/appsoft/software
[root@localhost software]# tar xvf MySQL-5.6.36-1.linux_glibc2.5.i386.rpm-bundle.tar

将解压出以下文件:
MySQL的测试组件MySQL-shared-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL的共享库MySQL-shared-compat-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL版本兼容的包MySQL-client-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL客户端程序MySQL-devel-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL的库和头文件MySQL-embedded-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL的嵌入式程序MySQL-server-5.6.22-1.linux_glibc2.5.i386.rpm
MySQL服务端程序

3.安装服务端

[root@localhost software]# rpm -ivh rpm -ivh MySQL-server-5.6.36-1.rhel5.i386.rpm
warning: MySQL-server-5.6.36-1.rhel5.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libaio.so.1 is needed by MySQL-server-5.6.36-1.rhel5.i386
libaio.so.1(LIBAIO_0.1) is needed by MySQL-server-5.6.36-1.rhel5.i386
libaio.so.1(LIBAIO_0.4) is needed by MySQL-server-5.6.36-1.rhel5.i386
libstdc++.so.6 is needed by MySQL-server-5.6.36-1.rhel5.i386
libstdc++.so.6(CXXABI_1.3) is needed by MySQL-server-5.6.36-1.rhel5.i386
libstdc++.so.6(GLIBCXX_3.4) is needed by MySQL-server-5.6.36-1.rhel5.i386
[root@ localhost software]# find / -name libaio.so.1
/lib64/libaio.so.1
[root@ localhost software]# find / -name libstdc++.so.6
/usr/lib64/libstdc++.so.6
如果出现以上错误说明缺少libaio.so.1和libstdc++.so.6
将libaio-0.3.107-10.el6.i686.rpm和libstdc++-4.4.7-4.el6.i686.rpm上传到/usr/appsoft/software并安装。

安装libaio-0.3.107-10.el6.i686.rpm:
[root@ localhost software]# rpm -ivh libaio-0.3.107-10.el6.i686.rpm
warning: libaio-0.3.107-10.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libaio ########################################### [100%]

安装libstdc++-4.4.7-4.el6.i686.rpm:
[root@ localhost software]# rpm -ivh libstdc++-4.4.7-4.el6.i686.rpm
warning: libstdc++-4.4.7-4.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libstdc++ ########################################### [100%]
以上两个rpm包安装完之后重新安装mysql服务端:
[root@localhost software] warning: MySQL-server-5.6.36-1.rhel5.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
2017-06-19 15:05:34 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-19 15:05:34 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-06-19 15:05:34 0 [Note] /usr/sbin/mysqld (mysqld 5.6.36) starting as process 2702 ...
2017-06-19 15:05:34 2702 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-06-19 15:05:34 2702 [Note] InnoDB: The InnoDB memory heap is disabled
2017-06-19 15:05:34 2702 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2017-06-19 15:05:34 2702 [Note] InnoDB: Memory barrier is not used
2017-06-19 15:05:34 2702 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-06-19 15:05:34 2702 [Note] InnoDB: Using Linux native AIO
2017-06-19 15:05:34 2702 [Note] InnoDB: Not using CPU crc32 instructions
2017-06-19 15:05:34 2702 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-06-19 15:05:34 2702 [Note] InnoDB: Completed initialization of buffer pool
2017-06-19 15:05:34 2702 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-06-19 15:05:34 2702 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-06-19 15:05:34 2702 [Note] InnoDB: Database physically writes the file full: wait...
2017-06-19 15:05:34 2702 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-06-19 15:05:34 2702 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-06-19 15:05:35 2702 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-06-19 15:05:35 2702 [Warning] InnoDB: New log files created, LSN=45781
2017-06-19 15:05:35 2702 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-06-19 15:05:35 2702 [Note] InnoDB: Doublewrite buffer created
2017-06-19 15:05:35 2702 [Note] InnoDB: 128 rollback segment(s) are active.
2017-06-19 15:05:35 2702 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-19 15:05:35 2702 [Note] InnoDB: Foreign key constraint system tables created
2017-06-19 15:05:35 2702 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-06-19 15:05:35 2702 [Note] InnoDB: Tablespace and datafile system tables created.
2017-06-19 15:05:35 2702 [Note] InnoDB: Waiting for purge to start
2017-06-19 15:05:35 2702 [Note] InnoDB: 5.6.36 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2017-06-19 15:05:35 2702 [Note] Binlog end
2017-06-19 15:05:35 2702 [Note] InnoDB: FTS optimize thread exiting.
2017-06-19 15:05:35 2702 [Note] InnoDB: Starting shutdown...
2017-06-19 15:05:37 2702 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2017-06-19 15:05:37 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-19 15:05:37 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-06-19 15:05:37 0 [Note] /usr/sbin/mysqld (mysqld 5.6.36) starting as process 2724 ...
2017-06-19 15:05:37 2724 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-06-19 15:05:37 2724 [Note] InnoDB: The InnoDB memory heap is disabled
2017-06-19 15:05:37 2724 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2017-06-19 15:05:37 2724 [Note] InnoDB: Memory barrier is not used
2017-06-19 15:05:37 2724 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-06-19 15:05:37 2724 [Note] InnoDB: Using Linux native AIO
2017-06-19 15:05:37 2724 [Note] InnoDB: Not using CPU crc32 instructions
2017-06-19 15:05:37 2724 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-06-19 15:05:37 2724 [Note] InnoDB: Completed initialization of buffer pool
2017-06-19 15:05:37 2724 [Note] InnoDB: Highest supported file format is Barracuda.
2017-06-19 15:05:37 2724 [Note] InnoDB: 128 rollback segment(s) are active.
2017-06-19 15:05:37 2724 [Note] InnoDB: Waiting for purge to start
2017-06-19 15:05:37 2724 [Note] InnoDB: 5.6.36 started; log sequence number 1625977
2017-06-19 15:05:37 2724 [Note] Binlog end
2017-06-19 15:05:37 2724 [Note] InnoDB: FTS optimize thread exiting.
2017-06-19 15:05:37 2724 [Note] InnoDB: Starting shutdown...
2017-06-19 15:05:39 2724 [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

4.安装库文件

[root@ localhost software]# rpm -ivh MySQL-devel-5.6.36-1.rhel5.i386.rpm
warning: MySQL-devel-5.6.36-1.rhel5.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]

5.安装客户端

[root@ localhost software]# rpm -ivh MySQL-client-5.6.35-1.rhel5.i386.rpm
warning: MySQL-client-5.6.35-1.rhel5.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libncurses.so.5 is needed by MySQL-client-5.6.35-1.rhel5.i386
报上面的错误说明缺少libncurses.so.5。
将ncurses-libs-5.7-3.20090208.el6.i686.rpm上传至/usr/appsoft/software
[root@localhost software]# rpm -ivh ncurses-libs-5.7-3.20090208.el6.i686.rpm
warning: ncurses-libs-5.7-3.20090208.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:ncurses-libs ########################################### [100%]
重新安装客户端:# rpm -ivh MySQL-client-5.6.35-1.rhel5.i386.rpm
warning: MySQL-client-5.6.35-1.rhel5.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]

MySQL默认安装路径:
a.数据库目录: /var/lib/mysql/
b.配置文件: /usr/share/mysql
c.相关命令: /usr/bin
d.启动脚本: /etc/rc.d/init.d/

6.修改配置文件,将MySQL的配置文件拷贝到/etc目录下。

[root@localhost mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
修改/etc/my.cnf,让数据库不区分表名大小写(此处错误会导致‘创建其他表’时错误)
在[mysqld]配置项下加入以下语句
lower_case_table_names=1
赋予用户写二进制备份数据的权限(创建触发器时必须有这权限)
log_bin_trust_function_creators=1
默认断开连接时间设为1年
wait_timeout=31536000
interactive_timeout=31536000
解决连接数据库过慢问题:
在[mysqld]下加入以下内容
character-set-server = utf8
character-set-filesystem = utf8
skip-name-resolve
不需要存日志的时候注释掉log-bin=mysql-bin
如果你需要日志,最好控制一下这些日志文件保留的天数,可以通过下面的配置设定日志文件保留的天数:
expire_logs_days = 7
表示保留7天的日志,这样老日志会自动被清理掉。

7.初始化MySQL

[root@localhost mysql]# /usr/bin/mysql_install_db

8.启动MySQL

[root@localhost mysql]# service mysql start
Starting MySQL.... SUCCESS!

检测mysql 3306是否安打开
[root@localhost mysql]# netstat -nattcp |grep 3306
0 0 :::3306 :::* LISTEN

9.从.mysql_secret查看root账号初始密码

[root@localhost mysql]# cat /root/.mysql_secret
The random password set for the root user at Thu Dec 18 21:08:44 2014 (local time): vuN8xfuKTRnmqX3I
其中vuN8xfuKTRnmqX3I为root账号的初始密码。

10.使用默认密码登陆mysql

[root@localhost mysql]# mysql -u root -pvuN8xfuKTRnmqX3I
Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.
Commands end with ; or /g.Your MySQL connection id is 4Server version: 5.6.22Copyright (c) 2000, 2014, Oracle and/or its affiliates.
All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

修改默认密码:
mysql> set password = password('iesapp');
Query OK, 0 rows affected (0.02 sec)
退出mysql
mysql> quit;
Bye

11.添加自启动服务

[root@localhost ~]# chkconfig --add mysql
[root@localhost ~]# chkconfig mysql on

12.创建数据库

mysql –u root –p iesapp
create database ms DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
create database ls DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;

设置访问权限(所有机器都可访问)

GRANT ALL PRIVILEGES ON 数据库名 TO '用户名'@'%' IDENTIFIED BY '密码';

flush privileges ;
quit;
重启mysql服务即可使用
service mysql restart;

关闭防火墙
[root@localhost ~]# service iptables stop
iptables: Flushing firewall rules:
[ OK ]iptables: Setting chains to policy ACCEPT: filter
[ OK ]iptables: Unloading modules:
[ OK ]

[root@localhost ~]# service iptables status
iptables: Firewall is not running.

MySQL5.6.36 linux rpm包安装配置文档的更多相关文章

  1. azkaban编译安装配置文档

    azkaban编译安装配置文档 参考官方文档: http://azkaban.github.io/azkaban/docs/latest/ azkaban的配置文件说明:http://azkaban. ...

  2. Oracle12C安装配置文档

    Oracle12C安装配置文档   Oracle12C安装配置文档 准备软件: 开始安装: 打开从官网下载下来的两个压缩包,进行解压 打开解压好的后缀为2of2的文件夹找到路径为database下的“ ...

  3. centos7.2下安装mysql5.7,使用rpm包安装

    0.环境 本文操作系统: CentOS 7.2.1511 x86_64 MySQL 版本: 5.7.16 1.卸载系统自带的 mariadb-lib[root@centos-linux ~]# rpm ...

  4. linux RPM包安装、更新、删除等操作命令简明总结, 如何查看yum安装的软件路径 ?

    rpm -ivh package.rpm 安装一个rpm包rpm -ivh --nodeeps package.rpm 安装一个rpm包而忽略依赖关系警告rpm -U package.rpm 更新一个 ...

  5. ELK(使用RPM包安装配置ELK)

    1,安装环境查看 2,下载rmp包 下载地址:https://www.elastic.co/cn/downloads 分别下载最新rmp包 elasticsearch-6.2.4.rpm logsta ...

  6. Linux rpm包安装不了

    有时候会发现安装rpm包时会报错,解决办法: 到rpm包所在目录执行 createrepo -v ./   这个命令 然后会生成一个repodate这个目录,然后在进行安装rpm就可以了!

  7. Linux rpm包安装MySQL数据库问题总结

    1.安装包准备 2.按顺序安装以下安装包 一定要按顺序安装,因为前面的包是后面包的依赖 [root@iz2ze1bzpi3orra8lboxqiz mysql]# rpm -ivh Percona-S ...

  8. Mongodb之使用rpm包安装配置启动

    下载rpm包 wget https://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/RPMS/mongod ...

  9. ELK之在CentOS7.5上使用rpm包安装配置ELK7版本

    一,安装环境查看 二,软件版本选用 jdk 1.8.0_171 elasticsearch 7.1.1 kibana 7.1.1 logstash 7.1.1 三,安装配置 1,安装JDK 过程不详述 ...

随机推荐

  1. 机器学习:Python实现聚类算法(三)之总结

    考虑到学习知识的顺序及效率问题,所以后续的几种聚类方法不再详细讲解原理,也不再写python实现的源代码,只介绍下算法的基本思路,使大家对每种算法有个直观的印象,从而可以更好的理解函数中参数的意义及作 ...

  2. 分清css的em和rem

    在css中单位长度用的最多的是px.em.rem,这三个的区别是: px是固定的像素,一旦设置了就无法因为适应页面大小而改变. em和rem相对于px更具有灵活性,他们是相对长度单位,意思是长度不是定 ...

  3. C语言进制转换的一个小错误

    今天学妹问了一个问题,问题是这样的 有以下程序 #include <stdio.h> void main(){ int  m=0256,n=256; printf("%o %o& ...

  4. 非滤波单目视觉slam笔记1

    非滤波单目视觉slam 主要分为以下8部分 数据类型 数据关联 初始化 位姿估计 地图维护 地图生成 失效恢复 回环检测 数据类型 直接法(稠密,半稠密) 基本原理是亮度一致性约束,\(J(x,y) ...

  5. Bash Shell编程要点小结

    一.case命令 case variable invalue1) command(s);; value2) command(s);; *) command(s);; esac 如果case变量没有被匹 ...

  6. phpcms v9 调用自定义字段多图片的第一张或第N张图为缩略图

    1.打开相应要使用组图的模型的组图字段,添加组图 字段提示为 <div class="content_attr"> <label><input typ ...

  7. Lucence_Curd

    设置Field的类型 new StringField 不分词(id,身份证号,电话...) new StoredField 不分词(链接) new TextField 分词(文本) new Fload ...

  8. 【转载】The Elements of Programming Style之代码风格金科玉律

    原始日期: 2017-02-06 16:20 <The Elements of Programming Style >是一本很古老的书.尽管 Fortran 我们不太使用,尽管新奇的语言层 ...

  9. Zabbix 3.2.6安装过程

    以3.2.6版本的Zabbix为例展开说明 1.准备Lnmp环境. 本次准备的环境: Linux:2.6.32-642.el6.x86_64 Nginx:1.12.0 Mariadb:10.2.6 P ...

  10. centos6.7下安装mysql5.6.22同时解决中文乱码问题

    1.下载 http://dev.mysql.com/downloads/mysql/ 或者使用wget下载: wget http://dev.mysql.com/get/Downloads/MySQL ...