CentOS6.8 二进制包安装MysqL5.7

MysqL5.7的二进制包可以去官网直接下载,比较慢


这里如果搜索的是source code 就是找源码包了,所以要搜索 linux-generic,搜索出来的就是二进制包了。

我这里是去国内镜像网站下载的,速度快一些。
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar

#创建运行MysqL的账号
[root@MysqL ~]# useradd MysqL -s /sbin/nologin
[root@MysqL ~]# id MysqL
uid=1001(MysqL) gid=1001(MysqL) 组=1001(MysqL)

#创建MysqL相关目录
[root@MysqL ~]# mkdir -p /data/MysqL/MysqL3306/{conf,data,logs,tmp}
[root@MysqL ~]# chown -R MysqL.MysqL /data/MysqL/

#解压MysqL安装文件到/usr/local下
[root@MysqL ~]# tar xf MysqL-5.7.20-linux-glibc2.12-x86_64.tar.gz  -C /usr/local/
[root@MysqL ~]# ln -sv /usr/local/MysqL-5.7.20-linux-glibc2.12-x86_64 /usr/local/MysqL
"/usr/local/MysqL" -> "/usr/local/MysqL-5.7.20-linux-glibc2.12-x86_64"

#创建MysqL配置文件
[root@MysqL ~]# cat /data/MysqL/MysqL3306/conf/my.cnf
[client]
port            = 3306
socket          = /tmp/MysqL3306.sock

[MysqL]
prompt="\\u@\\h [\\d]>"
#pager="less -i -n -S"
#tee=/opt/MysqL/query.log
no-auto-rehash

[MysqLd]
#misc
user = MysqL
basedir = /usr/local/MysqL
datadir = /data/MysqL/MysqL3306/data
port = 3306
socket = /tmp/MysqL3306.sock
event_scheduler = 0

tmpdir = /data/MysqL/MysqL3306/tmp
#timeout
interactive_timeout = 300
wait_timeout = 300

#character set
character-set-server = utf8

open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
lower_case_table_names =1

#
explicit_defaults_for_timestamp=1

#symi replication

#rpl_semi_sync_master_enabled=1
#rpl_semi_sync_master_timeout=1000 # 1 second
#rpl_semi_sync_slave_enabled=1

#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
pid-file = MysqL.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1

#binlog
#binlog_format = STATEMENT
binlog_format = row
server-id = 1013306
log-bin = /data/MysqL/MysqL3306/logs/MysqL-bin
binlog_cache_size = 1M
max_binlog_size = 256M
sync_binlog = 0
expire_logs_days = 10
#procedure
log_bin_trust_function_creators=1

#
gtid-mode = on
enforce-gtid-consistency=1

#relay log
skip_slave_start = 1
max_relay_log_size = 128M
relay_log_purge = 1
relay_log_recovery = 1
relay-log=relay-bin
relay-log-index=relay-bin.index
log_slave_updates
#slave-skip-errors=1032,1053,1062
#skip-grant-tables

#buffers & cache
table_open_cache = 2048
table_deFinition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 128K
join_buffer_size = 128K
thread_cache_size = 200
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M

#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1

#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 100M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT

loose_tokudb_cache_size=100M
loose_tokudb_directio=ON
loose_tokudb_fsync_log_period=1000
loose_tokudb_commit_sync=0

#初始化MysqL
[root@MysqL ~]# /usr/local/MysqL/bin/MysqLd --defaults-file=/data/MysqL/MysqL3306/conf/my.cnf --initialize

#获取初始化生成的密码
[root@MysqL ~]# cat /data/MysqL/MysqL3306/data/error.log | grep password | awk '{print $NF}'
H=?ycalZA4.e

#启动MysqL
[root@MysqL ~]# /usr/local/MysqL-5.7.20-linux-glibc2.12-x86_64/bin/MysqLd --defaults-file=/data/MysqL/MysqL3306/conf/my.cnf &
[1] 4596
[root@MysqL ~]# ss -tnl
State      Recv-Q Send-Q                                                                        Local Address:Port                                                                          Peer Address:Port
LISTEN     0      128                                                                                       *:22                                                                                       *:*
LISTEN     0      100                                                                               127.0.0.1:25                                                                                       *:*
LISTEN     0      70                                                                                       :::3306                                                                                    :::*
LISTEN     0      128                                                                                      :::22                                                                                      :::*
LISTEN     0      100                                                                                     ::1:25                                                                                      :::*
[root@MysqL ~]# ps aux |grep MysqL
MysqL     4596  3.8 17.8 1077724 181116 pts/0  Sl   04:01   0:00 /usr/local/MysqL-5.7.20-linux-glibc2.12-x86_64/bin/MysqLd --defaults-file=/data/MysqL/MysqL3306/conf/my.cnf
root      4632  0.0  0.0 112656   972 pts/0    R+   04:01   0:00 grep --color=auto MysqL

#连接到数据库
[root@MysqL ~]# /usr/local/MysqL/bin/MysqL -u root -p -S /tmp/MysqL3306.sock
Enter password:                         #这输入的是上文中获取到的密码
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 4
Server version: 5.7.20-log

copyright (c) 2000,2017,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;          
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

#修改root用户的密码为123456
MysqL> alter user user() identified by '123456';
Query OK,0 rows affected (0.00 sec)

MysqL> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| MysqL              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

#用新密码重新登陆
[root@MysqL ~]# /usr/local/MysqL/bin/MysqL -u root -p123456 -S /tmp/MysqL3306.sock
MysqL: [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 5
Server version: 5.7.20-log MysqL Community Server (GPL)

copyright (c) 2000,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>

关闭MysqL数据库

#通过MysqLadmin接口关闭数据库
[root@MysqL ~]# /usr/local/MysqL/bin/MysqLadmin -u root -p123456 -S /tmp/MysqL3306.sock shutdown
MysqLadmin: [Warning] Using a password on the command line interface can be insecure.

#检查结果[root@MysqL ~]# ss -tnl |grep 3306[root@MysqL ~]# ps aux |grep MysqL |grep -v grep

CentOS6.8 二进制包安装Mysql5.7的更多相关文章

  1. canvas中普通动效与粒子动效的实现代码示例

    canvas用于在网页上绘制图像、动画,可以将其理解为画布,在这个画布上构建想要的效果。本文详细的介绍了粒子特效,和普通动效进行对比,非常具有实用价值,需要的朋友可以参考下

  2. H5混合开发app如何升级的方法

    本篇文章主要介绍了H5混合开发app如何升级的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  3. canvas学习和滤镜实现代码

    这篇文章主要介绍了canvas学习和滤镜实现代码,利用 canvas,前端人员可以很轻松地、进行图像处理,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

  4. localStorage的过期时间设置的方法详解

    这篇文章主要介绍了localStorage的过期时间设置的方法详解的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

  5. 详解HTML5 data-* 自定义属性

    这篇文章主要介绍了详解HTML5 data-* 自定义属性的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  6. HTML5的postMessage的使用手册

    HTML5提出了一个新的用来跨域传值的方法,即postMessage,这篇文章主要介绍了HTML5的postMessage的使用手册的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  7. 教你使用Canvas处理图片的方法

    本篇文章主要介绍了教你使用Canvas处理图片的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  8. ios – 伞框架

    错误.应用程序,通常位于…错误仍然存在你也可以在这里添加(子)框架的路径.

  9. 如何在xcode 6中构建32位和64位的单二进制文件

    我已经遵循this堆栈溢出解决方案,但即使我得到低于警告.我已经选择虽然我得到了警告.请帮帮我.谢谢.解决方法有同样的问题.看起来将’arm64’添加到ValidArchitectures解决了它.

  10. ios – 使用Swift的Lumberjack 2.0记录器

    我以前使用物镜C的Lumberjack记录器,我喜欢它.现在我开始学习Swift,我不能在那里使用我最喜欢的记录器.有人可以一步一步地写出我能做到的事吗?在Lumberjack2.0发布之前,我尝试在这里找到一些东西,但所有主题都是自定义包装器.我做了什么:>我用Cocoapods添加了Lumberjack;>我将“#import”添加到Bridging-Header文件中.我不知道接下来该怎么办?因为在ObjC中我有宏:staticconstintddLogLevel=LOG_LEVEL_INFO;el

随机推荐

  1. 在airgapped(离线)CentOS 6系统上安装yum软件包

    我有一个CentOS6系统,出于安全考虑,它已经被空气泄漏.它可能从未连接到互联网,如果有,它很长时间没有更新.我想将所有.rpm软件包放在一个驱动器上,这样它们就可以脱机安装而无需查询互联网.但是,我在测试VM上遇到的问题是,即使指定了本地路径,yum仍然会挂起并尝试从在线存储库进行更新.另外,有没有办法使用yum-utils/yumdownloader轻松获取该包的所有依赖项和所有依赖项?目前

  2. centos – 命名在日志旋转后停止记录到rsyslog

    CentOS6.2,绑定9.7.3,rsyslog4.6.2我最近设置了一个服务器,我注意到在日志轮换后,named已停止记录到/var/log/messages.我认为这很奇怪,因为所有日志记录都是通过rsyslog进行的,并且named不会直接写入日志文件.这更奇怪,因为我在更新区域文件后命名了HUPed,但它仍然没有记录.在我停止并重新启动命名后,记录恢复.这里发生了什么?

  3. centos – 显示错误的磁盘大小

    对于其中一个磁盘,Df-h在我的服务器上显示错误的空白区域:Cpanel表明它只有34GB免费,但还有更多.几分钟前,我删除了超过80GB的日志文件.所以,我确信它完全错了.fdisk-l/dev/sda2也显示错误:如果没有格式化,我该怎么做才能解决这个问题?并且打开文件描述符就是它需要使用才能做到这一点.所以…使用“lsof”并查找已删除的文件.重新启动写入日志文件的服务,你很可能会看到空间可用.

  4. 如何在centos 6.9上安装docker-ce 17?

    我目前正在尝试在centOS6.9服务器上安装docker-ce17,但是,当运行yuminstalldocker-ce时,我收到以下错误:如果我用跳过的标志运行它我仍然得到相同的消息,有没有人知道这方面的方法?

  5. centos – 闲置工作站的异常负载平均值

    我有一个新的工作站,具有不寻常的高负载平均值.机器规格是:>至强cpu>256GB的RAM>4x512GBSSD连接到LSI2108RAID控制器我从livecd安装了CentOS6.564位,配置了分区,网络,用户/组,并安装了一些软件,如开发工具和MATLAB.在启动几分钟后,工作站负载平均值的值介于0.5到0.9之间.但它没有做任何事情.因此我无法理解为什么负载平均值如此之高.你能帮我诊断一下这个问题吗?

  6. centos – Cryptsetup luks – 检查内核是否支持aes-xts-plain64密码

    我在CentOS5上使用cryptsetupluks加密加密了一堆硬盘.一切都很好,直到我将系统升级到CentOS6.现在我再也无法安装磁盘了.使用我的关键短语装载:我收到此错误:在/var/log/messages中:有关如何装载的任何想法?找到解决方案问题是驱动器使用大约512个字符长的交互式关键短语加密.出于某种原因,CentOS6中的新内核模块在由旧版本创建时无法正确读取512个字符的加密密钥.似乎只会影响内核或cryptsetup的不同版本,因为在同一系统上创建和打开时,512字符的密钥将起作用

  7. centos – 大量ssh登录尝试

    22个我今天登录CentOS盒找到以下内容这是过去3天内的11次登录尝试.WTF?请注意,这是我从我的提供商处获得的全新IP,该盒子是全新的.我还没有发布任何关于此框的内容.为什么我会进行如此大量的登录尝试?是某种IP/端口扫描?基本上有4名匪徒,其中2名来自中国,1名来自香港,1名来自Verizon.这只发生在SSH上.HTTP上没有问题.我应该将罪魁祸首子网路由吗?你们有什么建议?

  8. centos – kswap使用100%的CPU,即使有100GB的RAM也可用

    >Linux内核是否应该足够智能,只需从内存中清除旧缓存页而不是启动kswap?

  9. centos – Azure将VM从A2 / 3调整为DS2 v2

    我正在尝试调整前一段时间创建的几个AzureVM,从基本的A3和标准A3到标准的DS2v2.我似乎没有能力调整到这个大小的VM.必须从头开始重建服务器会有点痛苦.如果它有所不同我在VM中运行CentOS,每个都有一个带有应用程序和操作系统的磁盘.任何人都可以告诉我是否可以在不删除磁盘的情况下删除VM,创建新VM然后将磁盘附加到新VM?

  10. centos – 广泛使用RAM时服务器计算速度减慢

    我在非常具体的情况下遇到服务器速度下降的问题.事实是:>1)我使用计算应用WRF>2)我使用双XeonE5-2620v3和128GBRAM(NUMA架构–可能与问题有关!

返回
顶部