-
下载安装包
mysql-5.7.22-1.el6.x86_64.rpm-bundle.tar
-
解压安装包
[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
-
安装
[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%]
-
检查并启动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...
-
登录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)
-
登录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)