mysql 5.6.35 rpm_MySQL5.6.36 linux rpm包安装配置文档

一、卸载自带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

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.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值