配置CentOS SCLo源

[3] 添加 CentOS SCLo Software collections Repository.
[root@linuxprobe~]# yum -y install centos-release-scl-rh centos-release-scl
# set [priority=10]
[root@linuxprobe~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo [root@linuxprobe~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
# for another way,change to [enabled=0] and use it only when needed
[root@linuxprobe~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
[root@dlp ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

yum安装MysqL

# 安装MysqL
[root@linuxprobe~]# yum --enablerepo=centos-sclo-rh -y install rh-MysqL56-MysqL-server
# 加载环境变量
[root@linuxprobe ~]# scl enable rh-MysqL56 bash
[root@linuxprobe ~]# MysqL -V 
MysqL  Ver 14.14 distrib 5.6.26,for Linux (x86_64) using  EditLine wrapper
[root@linuxprobe ~]# which MysqL 
/opt/rh/rh-MysqL56/root/usr/bin/MysqL
# 设置MysqL开机自启动
root@linuxprobe ~]# vi /etc/profile.d/rh-MysqL56.sh
#!/bin/bash
source /opt/rh/rh-MysqL56/enable
export X_SCLS="`scl enable rh-MysqL56 'echo $X_SCLS'`"
[4] Enable MysqL 5.6 and Configure initial settings.
[root@linuxprobe ~]# vi /etc/opt/rh/rh-MysqL56/my.cnf.d/MysqL-server.cnf
# add follows within [MysqLd] section
[MysqLd]
character-set-server=utf8
[root@linuxprobe ~]# systemctl start rh-MysqL56-MysqLd
[root@linuxprobe ~]# systemctl enable rh-MysqL56-MysqLd
[root@linuxprobe ~]# 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
Set root password? [Y/n] 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
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
disallow root login remotely? [Y/n] y
 ... Success!
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
Remove test database and access to it? [Y/n] 
 - 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
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@linuxprobe ~]# MysqL -u root -p
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 13
Server version: 5.6.26 MysqL Community Server (GPL)

copyright (c) 2000,2015,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> select user,host,password from MysqL.user; +------+-----------+-------------------------------------------+
| user | host | password | +------+-----------+-------------------------------------------+
| root | localhost | *E2ACEC2F2DA384EE6753673365DFEF35F0C272C9 | | root | 127.0.0.1 | *E2ACEC2F2DA384EE6753673365DFEF35F0C272C9 |
| root | ::1 | *E2ACEC2F2DA384EE6753673365DFEF35F0C272C9 | +------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
MysqL> show databases; +--------------------+
| Database | +--------------------+
| information_schema | | MysqL | | performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MysqL> exit
Bye

开启防火墙
[root@linuxprobe ~]# firewall-cmd –add-service=MysqL –permanent
success
[root@linuxprobe ~]# firewall-cmd –reload
success

  • 同样使用yum在vdevops.org上面安装MysqL,安装步骤参考上面

MysqL 主从

  • Master端:linuxprobe
[root@linuxprobe~]# vi /etc/opt/rh/rh-MysqL56/my.cnf.d/MysqL-server.cnf
[MysqLd]
# add follows in [MysqLd] section : get binary logs
log-bin=MysqL-bin
# define uniq server ID
server-id=101
[root@linuxprobe ~]# MysqL -u root -p 
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 2
Server version: 5.6.26-log MysqL Community Server (GPL)
copyright (c) 2000,2015,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> grant replication slave on *.* to replica@'%' identified by 'password';
Query OK,0 rows affected (0.07 sec)
MysqL> flush privileges; 
Query OK,0 rows affected (0.00 sec)
MysqL> exit
Bye

开启防火墙
[root@linuxprobe ~]# firewall-cmd –add-service=MysqL –permanent
success
[root@linuxprobe ~]# firewall-cmd –reload
success

  • Slave端:vdevops
[root@vdevops~]# vi /etc/opt/rh/rh-MysqL56/my.cnf.d/MysqL-server.cnf
[MysqLd]
# add follows in [MysqLd] section : get binary logs
log-bin=MysqL-bin
# define server ID (different one from Master Host)
server-id=102
# read only
read_only=1
# define own hostname
report-host=node01.srv.world
[root@vdevops~]# systemctl restart rh-MysqL56-MysqLd
  • Master端:备份数据库
[root@linuxprobe ~]# MysqL -u root -p
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 3
Server version: 5.6.26-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> flush tables with read lock;   # 锁表
Query OK,0 rows affected (0.01 sec)
MysqL> show master status;    #记住file的数值和position的值
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | binlog_Do_DB | binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| MysqL-bin.000001 |      400 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
MysqL> exit
Bye
#
[root@linuxprobe ~]# MysqLdump -u root -p --all-databases --lock-all-tables --events > MysqL_dump.sql # 备份数据库
Enter password: 
[root@linuxprobe ~]# MysqL -u root -p
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 5
Server version: 5.6.26-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> unlock tables;  # 解锁
Query OK,0 rows affected (0.00 sec)

MysqL> exit
Bye
[root@linuxprobe ~]# scp MysqL_dump.sql vdevops.org@/tmp/
cp: cannot create regular file ‘vdevops.org@/tmp/’: No such file or directory
[root@linuxprobe ~]# scp MysqL_dump.sql vdevops.org:/tmp/
The authenticity of host 'vdevops.org (10.1.1.56)' can't be established.
ECDSA key fingerprint is f8:d2:55:54:8f:e8:43:e0:ee:aa:d6:8d:53:8c:8e:85.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'vdevops.org' (ECDSA) to the list of kNown hosts.
MysqL_dump.sql
  • Slave 端:
[root@vdevops ~]# MysqL -u root -p < /tmp/MysqL_dump.sql
Enter password: 
[root@vdevops ~]# MysqL -u root -p 
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 3
Server version: 5.6.26-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> change master to
    -> master_host='10.1.1.53',# master ip
    -> master_user='replica',# replication ID
    -> master_password='password',# replication passwd
    -> master_log_file='MysqL-bin.000001',# bin-log number
    -> master_log_pos=400;          # position
Query OK,0 rows affected,2 warnings (0.03 sec)

MysqL> start slave;
Query OK,0 rows affected (0.01 sec)

MysqL> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.1.1.53
                  Master_User: replica
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: MysqL-bin.000001
          Read_Master_Log_Pos: 475
               Relay_Log_File: MysqLd-relay-bin.000002
                Relay_Log_Pos: 358
        Relay_Master_Log_File: MysqL-bin.000001
             Slave_IO_Running: Yes
            Slave_sql_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 475
              Relay_Log_Space: 532
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_sql_Errno: 0
               Last_sql_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 101
                  Master_UUID: d47dddc3-9c70-11e6-8efb-000c29ffc05a
             Master_Info_File: /var/opt/rh/rh-MysqL56/lib/MysqL/master.info
                    sql_Delay: 0
          sql_Remaining_Delay: NULL
      Slave_sql_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_sql_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
1 row in set (0.00 sec)

CentOS 7.2 Yum安装MySQL 5.6的更多相关文章

  1. 关于h5中的fetch方法解读(小结)

    这篇文章主要介绍了关于h5中的fetch方法解读(小结),fetch身为H5中的一个新对象,他的诞生,是为了取代ajax的存在而出现,有兴趣的可以了解一下

  2. 如何在iOS 10上设置日志级别?

    换句话说,如果我在iOS上运行的代码就像这样:那么在Console.app中看到记录的消息需要做些什么呢?

  3. 从iOS应用程序发送帖子到PHP脚本不工作…简单的解决方案就像

    我之前已经做了好几次了但是由于某些原因我无法通过这个帖子…我尝试了设置为_POST且没有的变量的PHP脚本……当它们未设置为发布时它工作精细.这是我的iOS代码:这里是PHP的一大块,POST变量不在正确的位置?我想这对于更有经验的开发人员来说是一个相当简单的答案,感谢您的帮助!解决方法$_POST是一个数组,而不是一个函数.您需要使用方括号来访问数组索引:

  4. 为什么Xcode 8(iOS 10)在控制台中打印[LogMessageLogging]

    为什么Xcode8打印[LogMessageLogging]在控制台中,当我调用地图视图时?任何人都可以提出一些建议吗?解决方法PrivacyTheunifiedloggingsystemconsidersdynamicstringsandcomplexdynamicobjectstobeprivate,anddoesnotcollectthemautomatically.Toensuretheprivacyofusers,itisrecommendedthatlogmessagesconsiststri

  5. ios – 在Swift 4中为os_log传递可变参数

    我正在尝试为Swift4/iOS11中的os_log编写一个方便的包装器,但是我已经遇到了传递可变参数的艰难战斗.基本上,我想编写一个如下所示的函数.不幸的是,我似乎无法弄清楚传递参数的神奇语法,并且在CVararg讨论的泥潭中有点迷失.(…这让我想念Python的splatting语法)解决方法我还没有找到解决方案,所以这个愚蠢的黑客:

  6. xcode – osx上的config.log是什么?它在哪里?

    任何人都可以解释’configure’是什么和做什么,一般可以找到config.log文件?

  7. api – HTTPS请求仅在iOS,Ionic 2上失败

    我有一个Ionic2应用程序,它调用SpringBootAPI将推送通知发送到其他设备.API使用HTTPS配置.APIPOST请求适用于除iOS之外的所有内容.我在服务器上的SSL证书是自签名的(可能就是这样吗?

  8. swift学习日志—— Log日志

    Log输出是程序开发中很重要的组成部分,虽然它并不是直接的业务代码,但是却可以忠实地反映我们的程序是如何工作的,以及记录程序运行的过程中发生了什么。在OC中的Log日志设置请看我的另一篇博客:设置Log日志打印开关在Swift中,最简单的输出方法就是使用print,在我们关心的地方输出字符串和值。如果我们在开发中就注意使用了统一的log输出的话,这就变得非常简单了。

  9. 使用XcodeColors 来显示XCGLogger,进行swift 的logger定制

    XcodeColors项目地址XcodeColorsinstallationinstructionsforXcode4,5,6&7:Downloadorclonetherepository.OpentheXcodeColorsprojectwithXcodeIfcompilingforXcode4,thenchangetheschemestousetheXcode4buildconfigurati

  10. swift 自定义log输出

    swift自定义log输出直接上代码

随机推荐

  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架构–可能与问题有关!

返回
顶部