Linux下安装MySQL5.7并配置bin log模式

  1. 下载安装包

mysql-5.7.22-1.el6.x86_64.rpm-bundle.tar

  1. 解压安装包

[root@mysql ceshi]# tar -xvf mysql-5.7.22-1.el6.x86_64.rpm-bundle.tar

mysql-community-embedded-devel-5.7.22-1.el6.x86_64.rpm

mysql-community-common-5.7.22-1.el6.x86_64.rpm

mysql-community-devel-5.7.22-1.el6.x86_64.rpm

mysql-community-client-5.7.22-1.el6.x86_64.rpm

mysql-community-test-5.7.22-1.el6.x86_64.rpm

mysql-community-embedded-5.7.22-1.el6.x86_64.rpm

mysql-community-server-5.7.22-1.el6.x86_64.rpm

mysql-community-libs-compat-5.7.22-1.el6.x86_64.rpm

mysql-community-libs-5.7.22-1.el6.x86_64.rpm

  1. 安装

[root@mysql ceshi]# rpm -ivh mysql-community-common-5.7.22-1.el6.x86_64.rpm

warning: mysql-community-common-5.7.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

        file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.22-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64

        file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.22-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64

        file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.22-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64

删除mysql-libs-5.1.71-1.el6.x86_64:

[root@mysql ceshi]# rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps

安装:

[root@mysql ceshi]# rpm -ivh mysql-community-common-5.7.22-1.el6.x86_64.rpm

warning: mysql-community-common-5.7.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:mysql-community-common ########################################### [100%]

[root@mysql ceshi]# rpm -ivh mysql-community-libs-5.7.22-1.el6.x86_64.rpm

warning: mysql-community-libs-5.7.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:mysql-community-libs   ########################################### [100%]

[root@mysql ceshi]# rpm -ivh mysql-community-client-5.7.22-1.el6.x86_64.rpm

warning: mysql-community-client-5.7.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:mysql-community-client ########################################### [100%]

[root@mysql ceshi]# rpm -ivh mysql-community-server-5.7.22-1.el6.x86_64.rpm

warning: mysql-community-server-5.7.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:mysql-community-server ########################################### [100%]

  1. 检查并启动mysqld服务

[root@mysql ceshi]# service mysqld status

mysqld is stopped

[root@mysql ceshi]# service mysqld start

Initializing MySQL database:  [FAILED]

[root@mysql ceshi]# service mysqld start

Starting mysqld:  [  OK  ]

[root@mysql ceshi]# service mysqld status

mysqld (pid  31932) is running...

  1. 登录mysql并修改密码

检查临时密码:

[root@mysql ceshi]# more /var/log/mysqld.log | grep "A temporary password"

2018-07-26T22:02:09.635351Z 1 [Note] A temporary password is generated for root@localhost: su4k;.%4.N7M

登录:

[root@mysql ceshi]# mysql -hlocalhost -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.22

 

Copyright (c) 2000, 2018, 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> set password=password('123456');

Query OK, 0 rows affected, 1 warning (0.00 sec)

 

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

  1. 登录mysql

[root@mysql ceshi]# mysql -hlocalhost -p123456

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 4

Server version: 5.7.22 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2018, 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安装完成。

 

 

允许远程连接:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Zh_123456' WITH GRANT OPTION;

flush privileges;

 

 

日志模式配置:

 

检查日志模式:

mysql> show variables like 'log_bin';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| log_bin       | OFF   |

+---------------+-------+

1 row in set (0.00 sec)

 

在/etc/my.cnf中添加:

log_bin=binary-log

server_id=1

 

重启mysqld服务

service mysqld restart

 

检查日志模式:

mysql> show variables like 'log_bin';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| log_bin       | ON    |

+---------------+-------+

1 row in set (0.00 sec)

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

丹心明月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值