linux下面mysql的rpm安装

Last login: Fri Feb 23 21:12:12 2018

[root@localhost ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.106  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 fe80::2365:5660:403e:d6c1  prefixlen 64  scopeid 0x20<link>

        ether 00:0c:29:eb:85:e8  txqueuelen 1000  (Ethernet)

        RX packets 57  bytes 5646 (5.5 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 59  bytes 7868 (7.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# rpm -qa | grep mysql

[root@localhost ~]# rpm -qa | grep mysqld

[root@localhost ~]# rz

-bash: rz: 未找到命令

[root@localhost ~]# yum install lrzsz

[root@localhost ~]# cd /usr/local

[root@localhost local]# mkdir server

[root@localhost local]# cd server

[root@localhost server]# mkdir mysql

[root@localhost server]# cd mysql

[root@localhost mysql]# rz

rz waiting to receive.

 zmodem trl+C ȡ

  100%   24518 KB  645 KB/s 00:00:38       0 Errors-5.7.21-1.el7.x86_64.rpm...

  100%     272 KB  272 KB/s 00:00:01       0 Errors6_64.rpm...

  100%    3691 KB 3691 KB/s 00:00:01       0 Errors_64.rpm...

  100%    2186 KB 2186 KB/s 00:00:01       0 Errors64.rpm...

  100%  167861 KB 1998 KB/s 00:01:24       0 Errors6_64.rpm...

[root@localhost mysql]# ls

mysql-community-client-5.7.21-1.el7.x86_64.rpm  

mysql-community-devel-5.7.21-1.el7.x86_64.rpm  

mysql-community-server-5.7.21-1.el7.x86_64.rpm

mysql-community-common-5.7.21-1.el7.x86_64.rpm  

mysql-community-libs-5.7.21-1.el7.x86_64.rpm

[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-common-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

...

删除:

  mariadb-libs.x86_64 1:5.5.56-2.el7                                                                                                                                    

作为依赖被删除:

  postfix.x86_64 2:2.10.1-6.el7                                                                                                                                         

完毕!

[root@localhost mysql]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-libs-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

错误:依赖检测失败:

        mysql-community-common(x86-64) >= 5.7.9 mysql-community-libs-5.7.21-1.el7.x86_64 需要

[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-common-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:mysql-community-common-5.7.21-1.e################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-libs-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:mysql-community-libs-5.7.21-1.el7################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-devel-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-devel-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:mysql-community-devel-5.7.21-1.el################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-client-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:mysql-community-client-5.7.21-1.e################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-server-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

错误:依赖检测失败:

        /usr/bin/perl mysql-community-server-5.7.21-1.el7.x86_64 需要

        perl(Getopt::Long) mysql-community-server-5.7.21-1.el7.x86_64 需要

        perl(strict) mysql-community-server-5.7.21-1.el7.x86_64 需要

[root@localhost mysql]#  rpm -qa |grep perl

[root@localhost mysql]# yum install perl

已加载插件:fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.cn99.com

 * extras: mirrors.nwsuaf.edu.cn

 * updates: mirrors.nwsuaf.edu.cn                                                                                                                                  

...

完毕!

[root@localhost mysql]# rpm -qa|grep perl

perl-HTTP-Tiny-0.033-3.el7.noarch

perl-Pod-Perldoc-3.20-4.el7.noarch

perl-Text-ParseWords-3.29-4.el7.noarch

perl-Pod-Usage-1.63-3.el7.noarch

perl-libs-5.16.3-292.el7.x86_64

perl-Exporter-5.68-3.el7.noarch

perl-Time-Local-1.2300-2.el7.noarch

perl-Carp-1.26-244.el7.noarch

perl-PathTools-3.40-5.el7.x86_64

perl-File-Temp-0.23.01-3.el7.noarch

perl-threads-shared-1.43-6.el7.x86_64

perl-Filter-1.49-3.el7.x86_64

perl-Getopt-Long-2.40-2.el7.noarch

perl-parent-0.225-244.el7.noarch

perl-podlators-2.5.1-3.el7.noarch

perl-Pod-Escapes-1.04-292.el7.noarch

perl-Encode-2.51-7.el7.x86_64

perl-macros-5.16.3-292.el7.x86_64

perl-Storable-2.45-3.el7.x86_64

perl-constant-1.27-2.el7.noarch

perl-Socket-2.010-4.el7.x86_64

perl-Time-HiRes-1.9725-3.el7.x86_64

perl-Scalar-List-Utils-1.27-248.el7.x86_64

perl-File-Path-2.09-2.el7.noarch

perl-threads-1.87-4.el7.x86_64

perl-Pod-Simple-3.28-4.el7.noarch

perl-5.16.3-292.el7.x86_64

[root@localhost mysql]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

警告:mysql-community-server-5.7.21-1.el7.x86_64.rpm: V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:mysql-community-server-5.7.21-1.e################################# [100%]

[root@localhost mysql]# rpm -qa|mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[root@localhost mysql]# rpm -qa|mysqld

2018-02-23T14:27:28.020618Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-02-23T14:27:28.022919Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 1819 ...

2018-02-23T14:27:28.030768Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2018-02-23T14:27:28.030813Z 0 [ERROR] Aborting

2018-02-23T14:27:28.030834Z 0 [Note] Binlog end

2018-02-23T14:27:28.030891Z 0 [Note] mysqld: Shutdown complete

[root@localhost mysql]# more /etc/my.cnf

...

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[root@localhost mysql]# mysqld --initialize

[root@localhost mysql]# systemctl status msyqld

Unit msyqld.service could not be found.

[root@localhost mysql]# systemctl status mysqld

mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

   Active: inactive (dead)

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

[root@localhost mysql]# systemctl start mysqld

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

[root@localhost mysql]# more /etc/my.cnf

...

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[root@localhost mysql]# more /var/log/mysqld.log

...

2018-02-23T14:32:23.519146Z 1 [Note] A temporary password is generated for root@localhost: n#hQy*mVI8Oe

...

[root@localhost mysql]# cd /var/lib/mysql

[root@localhost mysql]# ll

总用量 110628

-rw-r-----. 1 root root       56 2月  23 22:32 auto.cnf

-rw-r-----. 1 root root      420 2月  23 22:32 ib_buffer_pool

-rw-r-----. 1 root root 12582912 2月  23 22:32 ibdata1

-rw-r-----. 1 root root 50331648 2月  23 22:32 ib_logfile0

-rw-r-----. 1 root root 50331648 2月  23 22:32 ib_logfile1

drwxr-x---. 2 root root     4096 2月  23 22:32 mysql

drwxr-x---. 2 root root     8192 2月  23 22:32 performance_schema

drwxr-x---. 2 root root     8192 2月  23 22:32 sys

[root@localhost mysql]# chmod -R 777 *

[root@localhost mysql]# ll

总用量 110628

-rwxrwxrwx. 1 root root       56 2月  23 22:32 auto.cnf

-rwxrwxrwx. 1 root root      420 2月  23 22:32 ib_buffer_pool

-rwxrwxrwx. 1 root root 12582912 2月  23 22:32 ibdata1

-rwxrwxrwx. 1 root root 50331648 2月  23 22:32 ib_logfile0

-rwxrwxrwx. 1 root root 50331648 2月  23 22:32 ib_logfile1

drwxrwxrwx. 2 root root     4096 2月  23 22:32 mysql

drwxrwxrwx. 2 root root     8192 2月  23 22:32 performance_schema

drwxrwxrwx. 2 root root     8192 2月  23 22:32 sys

[root@localhost mysql]# systemctl start mysqld

[root@localhost mysql]# mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@localhost mysql]# more /var/log/mysqld.log

...

2018-02-23T14:32:23.519146Z 1 [Note] A temporary password is generated for root@localhost: n#hQy*mVI8Oe

...

[root@localhost mysql]# 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.7.21

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> exit

Bye

[root@localhost mysql]# mysqladmin -u root -p password 'root'

Enter password:

mysqladmin: [Warning] Using a password on the command line interface can be insecure.

Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

[root@localhost mysql]# mysql -u root -proot

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.21 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> grant all privileges on *.* to 'dfbb'@'%' identified by 'dfbb';

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

mysql> exit

Bye

[root@localhost mysql]# mysql -u dfbb -pdfbb

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 6

Server version: 5.7.21 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> exit

Bye

[root@localhost mysql]# firewall-cmd --state

running

[root@localhost mysql]# netstat -lant

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State      

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     

tcp        0      0 192.168.0.106:22        192.168.0.103:50425     ESTABLISHED

tcp6       0      0 :::22                   :::*                    LISTEN     

tcp6       0      0 :::3306                 :::*                    LISTEN     

[root@localhost mysql]# firewall-cmd --zone=public --add-port=3306/tcp -permanent

usage: see firewall-cmd man page

firewall-cmd: error: unrecognized arguments: -permanent

[root@localhost mysql]# firewall-cmd --zone=public --add-port=3306/tcp

success

[root@localhost mysql]# firewall-cmd --zone=public --list-ports

3306/tcp



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值