参考:https://blog.csdn.net/ncdx111/article/details/79818304
mysql-5.7.27 linux下的tar.gz包下载
链接:https://pan.baidu.com/s/13dE4jZdlg–KVgf7v97GBw
提取码:ud25
[root@master app]# ls
apache-tomcat-8.5.41 mysql-5.7.27-el7-x86_64 mysql-5.7.27-el7-x86_64.tar.gz
[root@master app]# mv mysql-5.7.27-el7-x86_64 mysql-5.7.27
[root@master app]# ls
apache-tomcat-8.5.41 mysql-5.7.27 mysql-5.7.27-el7-x86_64.tar.gz
[root@master app]# mv mysql-5.7.27 /usr/local/mysql
[root@master app]# cd /usr/local/mysql/
[root@master mysql]# ls
bin COPYING docs include lib man README share support-files
[root@master mysql]# cd man/
[root@master man]# cd ../..
[root@master local]# ls
bin etc games include lib lib64 libexec mysql sbin share src
[root@master local]# cd mysql/
[root@master mysql]# ls
bin COPYING docs include lib man README share support-files
[root@master mysql]# groupadd mysql
[root@master mysql]# useradd -r -g mysql mysql
[root@master mysql]# ll
total 36
drwxr-xr-x. 2 root root 4096 Sep 28 13:27 bin
-rw-r--r--. 1 7161 31415 17987 Jun 10 2019 COPYING
drwxr-xr-x. 2 root root 55 Sep 28 13:27 docs
drwxr-xr-x. 3 root root 4096 Sep 28 13:27 include
drwxr-xr-x. 5 root root 230 Sep 28 13:27 lib
drwxr-xr-x. 4 root root 30 Sep 28 13:27 man
-rw-r--r--. 1 7161 31415 2478 Jun 10 2019 README
drwxr-xr-x. 28 root root 4096 Sep 28 13:27 share
drwxr-xr-x. 2 root root 90 Sep 28 13:27 support-files
[root@master mysql]# chown -R mysql:mysql ./
[root@master mysql]# ll
total 36
drwxr-xr-x. 2 mysql mysql 4096 Sep 28 13:27 bin
-rw-r--r--. 1 mysql mysql 17987 Jun 10 2019 COPYING
drwxr-xr-x. 2 mysql mysql 55 Sep 28 13:27 docs
drwxr-xr-x. 3 mysql mysql 4096 Sep 28 13:27 include
drwxr-xr-x. 5 mysql mysql 230 Sep 28 13:27 lib
drwxr-xr-x. 4 mysql mysql 30 Sep 28 13:27 man
-rw-r--r--. 1 mysql mysql 2478 Jun 10 2019 README
drwxr-xr-x. 28 mysql mysql 4096 Sep 28 13:27 share
drwxr-xr-x. 2 mysql mysql 90 Sep 28 13:27 support-files
[root@master mysql]# cd /etc/
[root@master etc]# ls
abrt grub.d printcap
adjtime gshadow profile
aliases gshadow- profile.d
aliases.db gss protocols
alsa gssproxy pulse
alternatives host.conf purple
anacrontab hostname python
asound.conf hosts qemu-ga
at.deny hosts.allow qemu-kvm
audisp hosts.deny radvd.conf
audit hp rc0.d
autofs.conf idmapd.conf rc1.d
autofs_ldap_auth.conf init.d rc2.d
auto.master inittab rc3.d
auto.master.d inputrc rc4.d
auto.misc ipa rc5.d
auto.net iproute2 rc6.d
auto.smb ipsec.conf rc.d
avahi ipsec.d rc.local
bash_completion.d ipsec.secrets rdma
bashrc iscsi redhat-release
binfmt.d issue request-key.conf
bluetooth issue.net request-key.d
brltty java resolv.conf
brltty.conf jvm rpc
centos-release jvm-commmon rpm
centos-release-upstream kdump.conf rsyncd.conf
certmonger kernel rsyslog.conf
cgconfig.conf krb5.conf rsyslog.d
cgconfig.d krb5.conf.d rwtab
cgrules.conf ksmtuned.conf rwtab.d
cgsnapshot_blacklist.conf ld.so.cache samba
chkconfig.d ld.so.conf sane.d
chrony.conf ld.so.conf.d sasl2
chrony.keys libaudit.conf scl
cifs-utils libblockdev securetty
cron.d libibverbs.d security
cron.daily libnl selinux
cron.deny libreport services
cron.hourly libuser.conf sestatus.conf
cron.monthly libvirt setroubleshoot
crontab locale.conf setuptool.d
cron.weekly localtime sgml
crypttab login.defs shadow
csh.cshrc logrotate.conf shadow-
csh.login logrotate.d shells
cups lsm skel
cupshelpers lvm smartmontools
dbus-1 machine-id sos.conf
dconf magic speech-dispatcher
default mail.rc ssh
depmod.d makedumpfile.conf.sample ssl
dhcp man_db.conf sssd
DIR_COLORS maven statetab
DIR_COLORS.256color mke2fs.conf statetab.d
DIR_COLORS.lightbgcolor modprobe.d subgid
dleyna-server-service.conf modules-load.d subuid
dnsmasq.conf motd subversion
dnsmasq.d mtab sudo.conf
dracut.conf mtools.conf sudoers
dracut.conf.d multipath sudoers.d
drirc my.cnf sudo-ldap.conf
e2fsck.conf my.cnf.d sysconfig
egl nanorc sysctl.conf
enscript.cfg ndctl sysctl.d
environment netconfig systemd
ethertypes NetworkManager system-release
exports networks system-release-cpe
exports.d nfs.conf target
favicon.png nfsmount.conf tcsd.conf
fcoe nsswitch.conf terminfo
festival nsswitch.conf.bak tmpfiles.d
filesystems ntp trusted-key.key
firefox ntp.conf tuned
firewalld numad.conf udev
flatpak oddjob udisks2
fonts oddjobd.conf unbound
fprintd.conf oddjobd.conf.d updatedb.conf
fstab openldap UPower
fuse.conf opt usb_modeswitch.conf
fwupd os-release vconsole.conf
gconf PackageKit vimrc
gcrypt pam.d virc
gdbinit passwd vmware-tools
gdbinit.d passwd- wgetrc
gdm pbm2ppa.conf wpa_supplicant
geoclue pinforc wvdial.conf
GeoIP.conf pkcs11 X11
GeoIP.conf.default pki xdg
ghostscript plymouth xinetd.conf
glvnd pm xinetd.d
gnupg pnm2ppa.conf xml
GREP_COLORS polkit-1 yum
groff popt.d yum.conf
group postfix yum.repos.d
group- ppp
grub2.cfg prelink.conf.d
[root@master etc]# vi my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
#server_id = ...
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
#查询缓存
explicit_defaults_for_timestamp=true
#symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mysql.log
pid-file=/var/run/mysql/mysql.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
"/etc/my.cnf" 26L, 720C
[root@master etc]# vi my.cnf
[root@master etc]# vi my.cnf
[root@master etc]# cd /var/lib/mysql
-bash: cd: /var/lib/mysql: No such file or directory
[root@master etc]# cd /var/lib
[root@master lib]# ls
AccountsService cs geoclue misc postfix stateless
alsa dbus gssproxy mlocate pulse systemd
alternatives dhclient hyperv net-snmp rpcbind tpm
authconfig dnsmasq initramfs NetworkManager rpm tuned
bluetooth flatpak ipa-client nfs rpm-state udisks2
boltd fprint iscsi ntp rsyslog unbound
certmonger fwupd libvirt os-prober samba upower
chrony fwupdate lldpad PackageKit selinux vmware
color games logrotate plymouth setroubleshoot xkb
colord gdm machines polkit-1 sss yum
[root@master lib]# ll
total 8
drwxr-xr-x. 4 root root 32 May 8 2019 AccountsService
drwxr-xr-x. 2 root root 26 Jun 6 2019 alsa
drwxr-xr-x. 2 root root 4096 May 8 2019 alternatives
drwx------. 3 root root 18 May 8 2019 authconfig
drwxr-xr-x. 2 root root 6 Sep 12 2017 bluetooth
drwxr-xr-x. 2 root root 6 Nov 2 2018 boltd
drwxr-xr-x. 5 root root 46 May 8 2019 certmonger
drwxr-xr-x. 2 chrony chrony 6 Apr 13 2018 chrony
drwxr-xr-x. 3 root root 17 May 8 2019 color
drwxr-xr-x. 4 colord colord 67 May 8 2019 colord
drwxr-xr-x. 2 root root 6 Aug 4 2017 cs
drwxr-xr-x. 2 root root 24 May 8 2019 dbus
drwxr-xr-x. 2 root root 6 May 15 2018 dhclient
drwxr-xr-x. 2 root root 6 Oct 31 2018 dnsmasq
drwxr-xr-x. 3 root root 34 May 8 2019 flatpak
drwxr-xr-x. 2 root root 6 Oct 31 2018 fprint
drwxr-xr-x. 3 root root 39 May 8 2019 fwupd
drwxr-xr-x. 2 root root 6 Nov 9 2018 fwupdate
drwxr-xr-x. 2 root root 6 Apr 11 2018 games
drwxrwx--T. 7 gdm gdm 97 Sep 28 11:27 gdm
drwxr-xr-x. 2 geoclue geoclue 6 Oct 31 2018 geoclue
drwxr-xr-x. 4 root root 55 Sep 28 11:27 gssproxy
drwxr-xr-x. 2 root root 6 Oct 31 2018 hyperv
drwxr-xr-x. 2 root root 6 Nov 3 2018 initramfs
drwxr-xr-x. 4 root root 35 May 8 2019 ipa-client
drwxr-xr-x. 8 root root 90 May 8 2019 iscsi
drwxr-xr-x. 9 root root 106 May 8 2019 libvirt
drwxr-xr-x. 2 root root 6 Nov 6 2016 lldpad
drwxr-xr-x. 2 root root 30 Sep 28 12:46 logrotate
drwx------. 2 root root 6 May 8 2019 machines
drwxr-xr-x. 2 root root 37 May 8 2019 misc
drwxr-x---. 2 root slocate 24 Sep 28 12:46 mlocate
drwxr-xr-x. 4 root root 45 May 8 2019 net-snmp
drwx------. 2 root root 169 Sep 28 12:05 NetworkManager
drwxr-xr-x. 5 root root 105 May 8 2019 nfs
drwxr-xr-x. 2 ntp ntp 6 Apr 13 2018 ntp
drwxr-xr-x. 2 root root 6 Nov 6 2016 os-prober
drwxr-xr-x. 2 root root 52 Sep 28 11:40 PackageKit
drwxr-xr-x. 2 root root 27 May 8 2019 plymouth
drwxr-x---. 3 root polkitd 28 May 8 2019 polkit-1
drwx------. 2 postfix root 25 May 8 2019 postfix
drwx------. 2 pulse pulse 6 Apr 13 2018 pulse
drwx------. 2 rpc rpc 6 Oct 31 2018 rpcbind
drwxr-xr-x. 2 root root 4096 Sep 28 11:40 rpm
drwxr-xr-x. 3 root root 19 May 8 2019 rpm-state
drwx------. 2 root root 29 Sep 28 13:30 rsyslog
drwxr-xr-x. 4 root root 53 Jun 5 2019 samba
drwxr-xr-x. 2 root root 6 Nov 3 2018 selinux
drwx------. 2 setroubleshoot setroubleshoot 71 May 16 2019 setroubleshoot
drwxr-xr-x. 10 root root 120 May 8 2019 sss
drwxr-xr-x. 4 root root 35 May 8 2019 stateless
drwxr-xr-x. 5 root root 70 May 8 2019 systemd
drwx------. 2 tss tss 6 Aug 4 2017 tpm
drwxr-xr-x. 2 root root 6 Nov 5 2018 tuned
drwx------. 2 root root 6 Nov 3 2018 udisks2
drwxr-xr-x. 2 unbound unbound 22 Jun 4 2019 unbound
drwxr-xr-x. 2 root root 6 Oct 31 2018 upower
drwxr-xr-x. 3 root root 20 May 8 2019 vmware
drwxr-xr-x. 2 root root 29 Sep 28 12:04 xkb
drwxr-xr-x. 6 root root 80 Jun 3 2019 yum
[root@master lib]# mkdir mysql
[root@master lib]# ll
total 8
drwxr-xr-x. 4 root root 32 May 8 2019 AccountsService
drwxr-xr-x. 2 root root 26 Jun 6 2019 alsa
drwxr-xr-x. 2 root root 4096 May 8 2019 alternatives
drwx------. 3 root root 18 May 8 2019 authconfig
drwxr-xr-x. 2 root root 6 Sep 12 2017 bluetooth
drwxr-xr-x. 2 root root 6 Nov 2 2018 boltd
drwxr-xr-x. 5 root root 46 May 8 2019 certmonger
drwxr-xr-x. 2 chrony chrony 6 Apr 13 2018 chrony
drwxr-xr-x. 3 root root 17 May 8 2019 color
drwxr-xr-x. 4 colord colord 67 May 8 2019 colord
drwxr-xr-x. 2 root root 6 Aug 4 2017 cs
drwxr-xr-x. 2 root root 24 May 8 2019 dbus
drwxr-xr-x. 2 root root 6 May 15 2018 dhclient
drwxr-xr-x. 2 root root 6 Oct 31 2018 dnsmasq
drwxr-xr-x. 3 root root 34 May 8 2019 flatpak
drwxr-xr-x. 2 root root 6 Oct 31 2018 fprint
drwxr-xr-x. 3 root root 39 May 8 2019 fwupd
drwxr-xr-x. 2 root root 6 Nov 9 2018 fwupdate
drwxr-xr-x. 2 root root 6 Apr 11 2018 games
drwxrwx--T. 7 gdm gdm 97 Sep 28 11:27 gdm
drwxr-xr-x. 2 geoclue geoclue 6 Oct 31 2018 geoclue
drwxr-xr-x. 4 root root 55 Sep 28 11:27 gssproxy
drwxr-xr-x. 2 root root 6 Oct 31 2018 hyperv
drwxr-xr-x. 2 root root 6 Nov 3 2018 initramfs
drwxr-xr-x. 4 root root 35 May 8 2019 ipa-client
drwxr-xr-x. 8 root root 90 May 8 2019 iscsi
drwxr-xr-x. 9 root root 106 May 8 2019 libvirt
drwxr-xr-x. 2 root root 6 Nov 6 2016 lldpad
drwxr-xr-x. 2 root root 30 Sep 28 12:46 logrotate
drwx------. 2 root root 6 May 8 2019 machines
drwxr-xr-x. 2 root root 37 May 8 2019 misc
drwxr-x---. 2 root slocate 24 Sep 28 12:46 mlocate
drwxr-xr-x. 2 root root 6 Sep 28 13:56 mysql
drwxr-xr-x. 4 root root 45 May 8 2019 net-snmp
drwx------. 2 root root 169 Sep 28 12:05 NetworkManager
drwxr-xr-x. 5 root root 105 May 8 2019 nfs
drwxr-xr-x. 2 ntp ntp 6 Apr 13 2018 ntp
drwxr-xr-x. 2 root root 6 Nov 6 2016 os-prober
drwxr-xr-x. 2 root root 52 Sep 28 11:40 PackageKit
drwxr-xr-x. 2 root root 27 May 8 2019 plymouth
drwxr-x---. 3 root polkitd 28 May 8 2019 polkit-1
drwx------. 2 postfix root 25 May 8 2019 postfix
drwx------. 2 pulse pulse 6 Apr 13 2018 pulse
drwx------. 2 rpc rpc 6 Oct 31 2018 rpcbind
drwxr-xr-x. 2 root root 4096 Sep 28 11:40 rpm
drwxr-xr-x. 3 root root 19 May 8 2019 rpm-state
drwx------. 2 root root 29 Sep 28 13:30 rsyslog
drwxr-xr-x. 4 root root 53 Jun 5 2019 samba
drwxr-xr-x. 2 root root 6 Nov 3 2018 selinux
drwx------. 2 setroubleshoot setroubleshoot 71 May 16 2019 setroubleshoot
drwxr-xr-x. 10 root root 120 May 8 2019 sss
drwxr-xr-x. 4 root root 35 May 8 2019 stateless
drwxr-xr-x. 5 root root 70 May 8 2019 systemd
drwx------. 2 tss tss 6 Aug 4 2017 tpm
drwxr-xr-x. 2 root root 6 Nov 5 2018 tuned
drwx------. 2 root root 6 Nov 3 2018 udisks2
drwxr-xr-x. 2 unbound unbound 22 Jun 4 2019 unbound
drwxr-xr-x. 2 root root 6 Oct 31 2018 upower
drwxr-xr-x. 3 root root 20 May 8 2019 vmware
drwxr-xr-x. 2 root root 29 Sep 28 12:04 xkb
drwxr-xr-x. 6 root root 80 Jun 3 2019 yum
[root@master lib]# chown mysql mysql:mysql
chown: cannot access ‘mysql:mysql’: No such file or directory
[root@master lib]# chown mysql mysql
[root@master lib]# ll
total 8
drwxr-xr-x. 4 root root 32 May 8 2019 AccountsService
drwxr-xr-x. 2 root root 26 Jun 6 2019 alsa
drwxr-xr-x. 2 root root 4096 May 8 2019 alternatives
drwx------. 3 root root 18 May 8 2019 authconfig
drwxr-xr-x. 2 root root 6 Sep 12 2017 bluetooth
drwxr-xr-x. 2 root root 6 Nov 2 2018 boltd
drwxr-xr-x. 5 root root 46 May 8 2019 certmonger
drwxr-xr-x. 2 chrony chrony 6 Apr 13 2018 chrony
drwxr-xr-x. 3 root root 17 May 8 2019 color
drwxr-xr-x. 4 colord colord 67 May 8 2019 colord
drwxr-xr-x. 2 root root 6 Aug 4 2017 cs
drwxr-xr-x. 2 root root 24 May 8 2019 dbus
drwxr-xr-x. 2 root root 6 May 15 2018 dhclient
drwxr-xr-x. 2 root root 6 Oct 31 2018 dnsmasq
drwxr-xr-x. 3 root root 34 May 8 2019 flatpak
drwxr-xr-x. 2 root root 6 Oct 31 2018 fprint
drwxr-xr-x. 3 root root 39 May 8 2019 fwupd
drwxr-xr-x. 2 root root 6 Nov 9 2018 fwupdate
drwxr-xr-x. 2 root root 6 Apr 11 2018 games
drwxrwx--T. 7 gdm gdm 97 Sep 28 11:27 gdm
drwxr-xr-x. 2 geoclue geoclue 6 Oct 31 2018 geoclue
drwxr-xr-x. 4 root root 55 Sep 28 11:27 gssproxy
drwxr-xr-x. 2 root root 6 Oct 31 2018 hyperv
drwxr-xr-x. 2 root root 6 Nov 3 2018 initramfs
drwxr-xr-x. 4 root root 35 May 8 2019 ipa-client
drwxr-xr-x. 8 root root 90 May 8 2019 iscsi
drwxr-xr-x. 9 root root 106 May 8 2019 libvirt
drwxr-xr-x. 2 root root 6 Nov 6 2016 lldpad
drwxr-xr-x. 2 root root 30 Sep 28 12:46 logrotate
drwx------. 2 root root 6 May 8 2019 machines
drwxr-xr-x. 2 root root 37 May 8 2019 misc
drwxr-x---. 2 root slocate 24 Sep 28 12:46 mlocate
drwxr-xr-x. 2 mysql root 6 Sep 28 13:56 mysql
drwxr-xr-x. 4 root root 45 May 8 2019 net-snmp
drwx------. 2 root root 169 Sep 28 12:05 NetworkManager
drwxr-xr-x. 5 root root 105 May 8 2019 nfs
drwxr-xr-x. 2 ntp ntp 6 Apr 13 2018 ntp
drwxr-xr-x. 2 root root 6 Nov 6 2016 os-prober
drwxr-xr-x. 2 root root 52 Sep 28 11:40 PackageKit
drwxr-xr-x. 2 root root 27 May 8 2019 plymouth
drwxr-x---. 3 root polkitd 28 May 8 2019 polkit-1
drwx------. 2 postfix root 25 May 8 2019 postfix
drwx------. 2 pulse pulse 6 Apr 13 2018 pulse
drwx------. 2 rpc rpc 6 Oct 31 2018 rpcbind
drwxr-xr-x. 2 root root 4096 Sep 28 11:40 rpm
drwxr-xr-x. 3 root root 19 May 8 2019 rpm-state
drwx------. 2 root root 29 Sep 28 13:30 rsyslog
drwxr-xr-x. 4 root root 53 Jun 5 2019 samba
drwxr-xr-x. 2 root root 6 Nov 3 2018 selinux
drwx------. 2 setroubleshoot setroubleshoot 71 May 16 2019 setroubleshoot
drwxr-xr-x. 10 root root 120 May 8 2019 sss
drwxr-xr-x. 4 root root 35 May 8 2019 stateless
drwxr-xr-x. 5 root root 70 May 8 2019 systemd
drwx------. 2 tss tss 6 Aug 4 2017 tpm
drwxr-xr-x. 2 root root 6 Nov 5 2018 tuned
drwx------. 2 root root 6 Nov 3 2018 udisks2
drwxr-xr-x. 2 unbound unbound 22 Jun 4 2019 unbound
drwxr-xr-x. 2 root root 6 Oct 31 2018 upower
drwxr-xr-x. 3 root root 20 May 8 2019 vmware
drwxr-xr-x. 2 root root 29 Sep 28 12:04 xkb
drwxr-xr-x. 6 root root 80 Jun 3 2019 yum
[root@master lib]# chgrp mysql mysql
[root@master lib]# ll
total 8
drwxr-xr-x. 4 root root 32 May 8 2019 AccountsService
drwxr-xr-x. 2 root root 26 Jun 6 2019 alsa
drwxr-xr-x. 2 root root 4096 May 8 2019 alternatives
drwx------. 3 root root 18 May 8 2019 authconfig
drwxr-xr-x. 2 root root 6 Sep 12 2017 bluetooth
drwxr-xr-x. 2 root root 6 Nov 2 2018 boltd
drwxr-xr-x. 5 root root 46 May 8 2019 certmonger
drwxr-xr-x. 2 chrony chrony 6 Apr 13 2018 chrony
drwxr-xr-x. 3 root root 17 May 8 2019 color
drwxr-xr-x. 4 colord colord 67 May 8 2019 colord
drwxr-xr-x. 2 root root 6 Aug 4 2017 cs
drwxr-xr-x. 2 root root 24 May 8 2019 dbus
drwxr-xr-x. 2 root root 6 May 15 2018 dhclient
drwxr-xr-x. 2 root root 6 Oct 31 2018 dnsmasq
drwxr-xr-x. 3 root root 34 May 8 2019 flatpak
drwxr-xr-x. 2 root root 6 Oct 31 2018 fprint
drwxr-xr-x. 3 root root 39 May 8 2019 fwupd
drwxr-xr-x. 2 root root 6 Nov 9 2018 fwupdate
drwxr-xr-x. 2 root root 6 Apr 11 2018 games
drwxrwx--T. 7 gdm gdm 97 Sep 28 11:27 gdm
drwxr-xr-x. 2 geoclue geoclue 6 Oct 31 2018 geoclue
drwxr-xr-x. 4 root root 55 Sep 28 11:27 gssproxy
drwxr-xr-x. 2 root root 6 Oct 31 2018 hyperv
drwxr-xr-x. 2 root root 6 Nov 3 2018 initramfs
drwxr-xr-x. 4 root root 35 May 8 2019 ipa-client
drwxr-xr-x. 8 root root 90 May 8 2019 iscsi
drwxr-xr-x. 9 root root 106 May 8 2019 libvirt
drwxr-xr-x. 2 root root 6 Nov 6 2016 lldpad
drwxr-xr-x. 2 root root 30 Sep 28 12:46 logrotate
drwx------. 2 root root 6 May 8 2019 machines
drwxr-xr-x. 2 root root 37 May 8 2019 misc
drwxr-x---. 2 root slocate 24 Sep 28 12:46 mlocate
drwxr-xr-x. 2 mysql mysql 6 Sep 28 13:56 mysql
drwxr-xr-x. 4 root root 45 May 8 2019 net-snmp
drwx------. 2 root root 169 Sep 28 12:05 NetworkManager
drwxr-xr-x. 5 root root 105 May 8 2019 nfs
drwxr-xr-x. 2 ntp ntp 6 Apr 13 2018 ntp
drwxr-xr-x. 2 root root 6 Nov 6 2016 os-prober
drwxr-xr-x. 2 root root 52 Sep 28 11:40 PackageKit
drwxr-xr-x. 2 root root 27 May 8 2019 plymouth
drwxr-x---. 3 root polkitd 28 May 8 2019 polkit-1
drwx------. 2 postfix root 25 May 8 2019 postfix
drwx------. 2 pulse pulse 6 Apr 13 2018 pulse
drwx------. 2 rpc rpc 6 Oct 31 2018 rpcbind
drwxr-xr-x. 2 root root 4096 Sep 28 11:40 rpm
drwxr-xr-x. 3 root root 19 May 8 2019 rpm-state
drwx------. 2 root root 29 Sep 28 13:30 rsyslog
drwxr-xr-x. 4 root root 53 Jun 5 2019 samba
drwxr-xr-x. 2 root root 6 Nov 3 2018 selinux
drwx------. 2 setroubleshoot setroubleshoot 71 May 16 2019 setroubleshoot
drwxr-xr-x. 10 root root 120 May 8 2019 sss
drwxr-xr-x. 4 root root 35 May 8 2019 stateless
drwxr-xr-x. 5 root root 70 May 8 2019 systemd
drwx------. 2 tss tss 6 Aug 4 2017 tpm
drwxr-xr-x. 2 root root 6 Nov 5 2018 tuned
drwx------. 2 root root 6 Nov 3 2018 udisks2
drwxr-xr-x. 2 unbound unbound 22 Jun 4 2019 unbound
drwxr-xr-x. 2 root root 6 Oct 31 2018 upower
drwxr-xr-x. 3 root root 20 May 8 2019 vmware
drwxr-xr-x. 2 root root 29 Sep 28 12:04 xkb
drwxr-xr-x. 6 root root 80 Jun 3 2019 yum
[root@master lib]# cd mysql/
[root@master mysql]# ls
[root@master mysql]#
[root@master mysql]# ll
total 0
[root@master mysql]# mysql -uroot -p
bash: mysql: command not found...
[root@master mysql]# cd /usr/local/mysql/
[root@master mysql]# cd bin/
[root@master bin]# ls
innochecksum mysql_config_editor mysqlshow
lz4_decompress mysqld mysqlslap
myisamchk mysqld-debug mysql_ssl_rsa_setup
myisam_ftdump mysqld_multi mysqltest_embedded
myisamlog mysqld_safe mysql_tzinfo_to_sql
myisampack mysqldump mysql_upgrade
my_print_defaults mysqldumpslow mysqlxtest
mysql mysql_embedded perror
mysqladmin mysqlimport replace
mysqlbinlog mysql_install_db resolveip
mysqlcheck mysql_plugin resolve_stack_dump
mysql_client_test_embedded mysqlpump zlib_decompress
mysql_config mysql_secure_installation
[root@master bin]# ll
total 1247624
-rwxr-xr-x. 1 mysql mysql 9068176 Jun 10 2019 innochecksum
-rwxr-xr-x. 1 mysql mysql 321360 Jun 10 2019 lz4_decompress
-rwxr-xr-x. 1 mysql mysql 8232168 Jun 10 2019 myisamchk
-rwxr-xr-x. 1 mysql mysql 7747800 Jun 10 2019 myisam_ftdump
-rwxr-xr-x. 1 mysql mysql 7522040 Jun 10 2019 myisamlog
-rwxr-xr-x. 1 mysql mysql 7870136 Jun 10 2019 myisampack
-rwxr-xr-x. 1 mysql mysql 5521312 Jun 10 2019 my_print_defaults
-rwxr-xr-x. 1 mysql mysql 10811944 Jun 10 2019 mysql
-rwxr-xr-x. 1 mysql mysql 9608696 Jun 10 2019 mysqladmin
-rwxr-xr-x. 1 mysql mysql 11535136 Jun 10 2019 mysqlbinlog
-rwxr-xr-x. 1 mysql mysql 9903512 Jun 10 2019 mysqlcheck
-rwxr-xr-x. 1 mysql mysql 204128912 Jun 10 2019 mysql_client_test_embedded
-rwxr-xr-x. 1 mysql mysql 4828 Jun 10 2019 mysql_config
-rwxr-xr-x. 1 mysql mysql 8459392 Jun 10 2019 mysql_config_editor
-rwxr-xr-x. 1 mysql mysql 247860416 Jun 10 2019 mysqld
-rwxr-xr-x. 1 mysql mysql 167232544 Jun 10 2019 mysqld-debug
-rwxr-xr-x. 1 mysql mysql 26738 Jun 10 2019 mysqld_multi
-rwxr-xr-x. 1 mysql mysql 28494 Jun 10 2019 mysqld_safe
-rwxr-xr-x. 1 mysql mysql 9960232 Jun 10 2019 mysqldump
-rwxr-xr-x. 1 mysql mysql 7464 Jun 10 2019 mysqldumpslow
-rwxr-xr-x. 1 mysql mysql 203210704 Jun 10 2019 mysql_embedded
-rwxr-xr-x. 1 mysql mysql 9606632 Jun 10 2019 mysqlimport
-rwxr-xr-x. 1 mysql mysql 11020216 Jun 10 2019 mysql_install_db
-rwxr-xr-x. 1 mysql mysql 5581944 Jun 10 2019 mysql_plugin
-rwxr-xr-x. 1 mysql mysql 19131240 Jun 10 2019 mysqlpump
-rwxr-xr-x. 1 mysql mysql 9551304 Jun 10 2019 mysql_secure_installation
-rwxr-xr-x. 1 mysql mysql 9564216 Jun 10 2019 mysqlshow
-rwxr-xr-x. 1 mysql mysql 9657200 Jun 10 2019 mysqlslap
-rwxr-xr-x. 1 mysql mysql 5959088 Jun 10 2019 mysql_ssl_rsa_setup
-rwxr-xr-x. 1 mysql mysql 202738840 Jun 10 2019 mysqltest_embedded
-rwxr-xr-x. 1 mysql mysql 5135000 Jun 10 2019 mysql_tzinfo_to_sql
-rwxr-xr-x. 1 mysql mysql 13161416 Jun 10 2019 mysql_upgrade
-rwxr-xr-x. 1 mysql mysql 25113456 Jun 10 2019 mysqlxtest
-rwxr-xr-x. 1 mysql mysql 5658568 Jun 10 2019 perror
-rwxr-xr-x. 1 mysql mysql 5312048 Jun 10 2019 replace
-rwxr-xr-x. 1 mysql mysql 5520936 Jun 10 2019 resolveip
-rwxr-xr-x. 1 mysql mysql 5601152 Jun 10 2019 resolve_stack_dump
-rwxr-xr-x. 1 mysql mysql 128792 Jun 10 2019 zlib_decompress
[root@master bin]# ./mysqld --initialize --user=mysql
2016-09-28T05:59:28.486348Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-09-28T05:59:28.623049Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-09-28T05:59:28.683113Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b7a51ad0-8540-11e6-a19c-000c29f4c930.
2016-09-28T05:59:28.684333Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-09-28T05:59:28.685184Z 1 [Note] A temporary password is generated for root@localhost: On3MO9o;kf#Y
[root@master bin]# cd ..
[root@master mysql]# ls
bin COPYING data docs include lib man README share support-files
[root@master mysql]# cd d
data/ docs/
[root@master mysql]# ll
total 36
drwxr-xr-x. 2 mysql mysql 4096 Sep 28 13:27 bin
-rw-r--r--. 1 mysql mysql 17987 Jun 10 2019 COPYING
drwxr-x---. 5 mysql mysql 147 Sep 28 13:59 data
drwxr-xr-x. 2 mysql mysql 55 Sep 28 13:27 docs
drwxr-xr-x. 3 mysql mysql 4096 Sep 28 13:27 include
drwxr-xr-x. 5 mysql mysql 230 Sep 28 13:27 lib
drwxr-xr-x. 4 mysql mysql 30 Sep 28 13:27 man
-rw-r--r--. 1 mysql mysql 2478 Jun 10 2019 README
drwxr-xr-x. 28 mysql mysql 4096 Sep 28 13:27 share
drwxr-xr-x. 2 mysql mysql 90 Sep 28 13:27 support-files
[root@master mysql]# cd data/
[root@master data]# ll
total 110628
-rw-r-----. 1 mysql mysql 56 Sep 28 13:59 auto.cnf
-rw-r-----. 1 mysql mysql 424 Sep 28 13:59 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Sep 28 13:59 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Sep 28 13:59 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Sep 28 13:59 ib_logfile1
drwxr-x---. 2 mysql mysql 4096 Sep 28 13:59 mysql
drwxr-x---. 2 mysql mysql 8192 Sep 28 13:59 performance_schema
drwxr-x---. 2 mysql mysql 8192 Sep 28 13:59 sys
[root@master data]# cd ..
[root@master mysql]# chown -R root:root ./
[root@master mysql]# ll
total 36
drwxr-xr-x. 2 root root 4096 Sep 28 13:27 bin
-rw-r--r--. 1 root root 17987 Jun 10 2019 COPYING
drwxr-x---. 5 root root 147 Sep 28 13:59 data
drwxr-xr-x. 2 root root 55 Sep 28 13:27 docs
drwxr-xr-x. 3 root root 4096 Sep 28 13:27 include
drwxr-xr-x. 5 root root 230 Sep 28 13:27 lib
drwxr-xr-x. 4 root root 30 Sep 28 13:27 man
-rw-r--r--. 1 root root 2478 Jun 10 2019 README
drwxr-xr-x. 28 root root 4096 Sep 28 13:27 share
drwxr-xr-x. 2 root root 90 Sep 28 13:27 support-files
[root@master mysql]# chown -R mysql:mysql data
[root@master mysql]# ll
total 36
drwxr-xr-x. 2 root root 4096 Sep 28 13:27 bin
-rw-r--r--. 1 root root 17987 Jun 10 2019 COPYING
drwxr-x---. 5 mysql mysql 147 Sep 28 13:59 data
drwxr-xr-x. 2 root root 55 Sep 28 13:27 docs
drwxr-xr-x. 3 root root 4096 Sep 28 13:27 include
drwxr-xr-x. 5 root root 230 Sep 28 13:27 lib
drwxr-xr-x. 4 root root 30 Sep 28 13:27 man
-rw-r--r--. 1 root root 2478 Jun 10 2019 README
drwxr-xr-x. 28 root root 4096 Sep 28 13:27 share
drwxr-xr-x. 2 root root 90 Sep 28 13:27 support-files
[root@master mysql]# vi /etc/init.d/mysql
[root@master mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@master mysql]# cd support-files/
[root@master support-files]# ll
total 24
-rw-r--r--. 1 root root 773 Jun 10 2019 magic
-rwxr-xr-x. 1 root root 1061 Jun 10 2019 mysqld_multi.server
-rwxr-xr-x. 1 root root 894 Jun 10 2019 mysql-log-rotate
-rwxr-xr-x. 1 root root 10576 Jun 10 2019 mysql.server
[root@master support-files]# cd /etc/init.d/
[root@master init.d]# ls
functions mysql netconsole network README
[root@master init.d]# ll
total 52
-rw-r--r--. 1 root root 18281 Aug 24 2018 functions
-rwxr-xr-x. 1 root root 10576 Sep 28 14:03 mysql
-rwxr-xr-x. 1 root root 4569 Aug 24 2018 netconsole
-rwxr-xr-x. 1 root root 7923 Aug 24 2018 network
-rw-r--r--. 1 root root 1160 Oct 31 2018 README
[root@master init.d]# chkconfig --add mysql
[root@master init.d]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd based services:
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
tcpmux-server: off
time-dgram: off
time-stream: off
[root@master init.d]# service mysql start
Starting MySQL. SUCCESS!
[root@master init.d]# ln -s /var/lib/mysql/mysql.sock /tmp/
[root@master init.d]# vi /var/lib/mysql/mysql.sock
[root@master init.d]# ln -s /usr/local/mysql/bin/mysql /usr/bin/
[root@master init.d]# service mysql ststus
Usage: mysql {start|stop|restart|reload|force-reload|status} [ MySQL server options ]
[root@master init.d]# service mysql status
SUCCESS! MySQL running (17399)
[root@master init.d]# 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.7.27
Copyright (c) 2000, 2019, 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> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from mysql.user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
3 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
[root@master init.d]# 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.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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> update user set host='%' where user='root';
ERROR 1046 (3D000): No database selected
mysql> update mysql.user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> user mysql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user mysql' at line 1
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from mysql.user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+---------------+
3 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@master init.d]#