Last login: Fri Feb 23 21:12:12 2018
[[email protected] ~]# 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
[[email protected] ~]# rpm -qa | grep mysql
[[email protected] ~]# rpm -qa | grep mysqld
[[email protected] ~]# rz
-bash: rz: 未找到命令
[[email protected] ~]# yum install lrzsz
[[email protected] ~]# cd /usr/local
[[email protected] local]# mkdir server
[[email protected] local]# cd server
[[email protected] server]# mkdir mysql
[[email protected] server]# cd mysql
[[email protected] 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...
[[email protected] 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
[[email protected] 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
完毕!
[[email protected] 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 需要
[[email protected] 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%]
[[email protected] 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%]
[[email protected] 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%]
[[email protected] 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%]
[[email protected] 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 需要
[[email protected] mysql]# rpm -qa |grep perl
[[email protected] 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
...
完毕!
[[email protected] 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
[[email protected] 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%]
[[email protected] mysql]# rpm -qa|mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[[email protected] 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
[[email protected] 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
[[email protected] mysql]# mysqld --initialize
[[email protected] mysql]# systemctl status msyqld
Unit msyqld.service could not be found.
[[email protected] 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
[[email protected] 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.
[[email protected] 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
[[email protected] mysql]# more /var/log/mysqld.log
...
2018-02-23T14:32:23.519146Z 1 [Note] A temporary password is generated for [email protected]: n#hQy*mVI8Oe
...
[[email protected] mysql]# cd /var/lib/mysql
[[email protected] 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
[[email protected] mysql]# chmod -R 777 *
[[email protected] 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
[[email protected] mysql]# systemctl start mysqld
[[email protected] mysql]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[[email protected] mysql]# more /var/log/mysqld.log
...
2018-02-23T14:32:23.519146Z 1 [Note] A temporary password is generated for [email protected]: n#hQy*mVI8Oe
...
[[email protected] 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
[[email protected] 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.
[[email protected] 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
[[email protected] 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
[[email protected] mysql]# firewall-cmd --state
running
[[email protected] 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
[[email protected] mysql]# firewall-cmd --zone=public --add-port=3306/tcp -permanent
usage: see firewall-cmd man page
firewall-cmd: error: unrecognized arguments: -permanent
[[email protected] mysql]# firewall-cmd --zone=public --add-port=3306/tcp
success
[[email protected] mysql]# firewall-cmd --zone=public --list-ports
3306/tcp