暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

centos7.9+mysql8.0.29 rpm安装及修改data路径

原创 jieguo 2022-06-14
2299

mysql8.0.29 rpm安装
相关参考:
1.安装参考:https://blog.csdn.net/weixin_45351743/article/details/114288181
2.修改数据和日志路径:https://blog.csdn.net/zhouzhouruize/article/details/118557855
https://blog.51cto.com/u_15338523/3586638

1.安装mysql

[root@heavydb network-scripts]# ping www.baidu.com                                                                                                                                         
ping: www.baidu.com: Name or service not known
[root@heavydb network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens36: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 00:50:56:2d:c0:75 brd ff:ff:ff:ff:ff:ff
3: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 00:50:56:2d:c0:75 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:50:56:2d:c0:75 brd ff:ff:ff:ff:ff:ff
    inet 192.168.52.167/24 brd 192.168.52.255 scope global noprefixroute bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::5c6a:957a:673c:a99c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[root@heavydb ~]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 223.5.5.5
[root@heavydb network-scripts]# ping www.baidu.com
PING www.a.shifen.com (110.242.68.3) 56(84) bytes of data.
64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=1 ttl=128 time=9.93 ms
64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=2 ttl=128 time=10.2 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 9.933/10.089/10.246/0.185 ms
[root@heavydb network-scripts]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2022-06-14 14:28:14--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 60.9.1.239, 60.9.1.241, 101.75.234.103, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|60.9.1.239|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[==================================================================================================================================================>] 2,523       --.-K/s   in 0.005s  

2022-06-14 14:28:14 (486 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]

[root@heavydb network-scripts]#  yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base epel extras updates
Cleaning up list of fastest mirrors
[root@heavydb network-scripts]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                                                 | 8.0 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
base                                                                                                                                                                 | 3.6 kB  00:00:00     
epel                                                                                                                                                                 | 4.7 kB  00:00:00     
extras                                                                                                                                                               | 2.9 kB  00:00:00     
updates                                                                                                                                                              | 2.9 kB  00:00:00     
(1/16): base/7/x86_64/group_gz                                                                                                                                       | 153 kB  00:00:00     
(2/16): base/7/x86_64/primary_db                                                                                                                                     | 6.1 MB  00:00:15     
(3/16): epel/x86_64/group_gz                                                                                                                                         |  96 kB  00:00:00     
(4/16): epel/x86_64/prestodelta                                                                                                                                      |  468 B  00:00:00     
(5/16): epel/x86_64/updateinfo                                                                                                                                       | 1.0 MB  00:00:02     
epel/x86_64/other_db           FAILED                                           32% [======================                                               ] 1.6 MB/s |  21 MB  00:00:27 ETA 
https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/7/x86_64/repodata/cf6b2af519b64f2e73b4f4395bc78d074df403cd5fe318d3a1fbd1f8c400ddf5-other.sqlite.bz2: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

(6/16): extras/7/x86_64/filelists_db                                                                                                                                 | 277 kB  00:00:02     
(7/16): epel/x86_64/filelists_db                                                                                                                                     |  12 MB  00:00:07     
(8/16): base/7/x86_64/other_db                                                                                                                                       | 2.6 MB  00:00:08     
(9/16): extras/7/x86_64/primary_db                                                                                                                                   | 247 kB  00:00:00     
(10/16): base/7/x86_64/filelists_db                                                                                                                                  | 7.2 MB  00:00:23     
(11/16): extras/7/x86_64/other_db                                                                                                                                    | 148 kB  00:00:01     
(12/16): epel/x86_64/primary_db                                                                                                                                      | 7.0 MB  00:00:13     
(13/16): updates/7/x86_64/filelists_db                                                                                                                               | 8.7 MB  00:00:21     
(14/16): epel/x86_64/other_db                                                                                                                                        | 3.4 MB  00:00:02     
(15/16): updates/7/x86_64/other_db                                                                                                                                   | 1.0 MB  00:00:02     
(16/16): updates/7/x86_64/primary_db                                                                                                                                 |  16 MB  00:00:37     
Metadata Cache Created
[root@heavydb network-scripts]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
--2022-06-14 14:30:18--  http://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 60.9.0.244, 60.9.0.243, 60.9.1.248, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|60.9.0.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/epel.repo’

100%[==================================================================================================================================================>] 664         --.-K/s   in 0.001s  

2022-06-14 14:30:18 (767 KB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664]

[root@heavydb network-scripts]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                                                     repo name                                                                                                 status
base/7/x86_64                                                               CentOS-7 - Base - mirrors.aliyun.com                                                                      10,072
epel/x86_64                                                                 Extra Packages for Enterprise Linux 7 - x86_64                                                            13,752
extras/7/x86_64                                                             CentOS-7 - Extras - mirrors.aliyun.com                                                                       512
updates/7/x86_64                                                            CentOS-7 - Updates - mirrors.aliyun.com                                                                    3,863
repolist: 28,199
[root@heavydb network-scripts]# yum info yum
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Installed Packages
Name        : yum
Arch        : noarch
Version     : 3.4.3
Release     : 168.el7.centos
Size        : 5.6 M
Repo        : installed
From repo   : anaconda
Summary     : RPM package installer/updater/manager
URL         : http://yum.baseurl.org/
License     : GPLv2+
Description : Yum is a utility that can check for and automatically download and
            : install updated RPM packages. Dependencies are obtained and downloaded
            : automatically, prompting the user for permission as necessary.

[root@heavydb network-scripts]# rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@heavydb network-scripts]# yum remove mariadb-libs-5.5.68-1.el7.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be erased
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.10.1-9.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                        Arch                                     Version                                          Repository                                   Size
============================================================================================================================================================================================
Removing:
 mariadb-libs                                   x86_64                                   1:5.5.68-1.el7                                   @anaconda                                   4.4 M
Removing for dependencies:
 postfix                                        x86_64                                   2:2.10.1-9.el7                                   @anaconda                                    12 M

Transaction Summary
============================================================================================================================================================================================
Remove  1 Package (+1 Dependent package)

Installed size: 17 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                            1/2 
  Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                       2/2 
  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                       1/2 
  Verifying  : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                            2/2 

Removed:
  mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                                                                        

Dependency Removed:
  postfix.x86_64 2:2.10.1-9.el7                                                                                                                                                             

Complete!
[root@heavydb network-scripts]# rpm -aq|grep glic
[root@heavydb network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@heavydb network-scripts]# cd /root
[root@heavydb ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.8G     0  3.8G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G   12M  3.8G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   35G   30G  5.6G  85% /
/dev/sda1               1014M  151M  864M  15% /boot
tmpfs                    781M     0  781M   0% /run/user/0
[root@heavydb ~]# wget https://repo.mysql.com//mysql80-community-release-el7-6.noarch.rpm
--2022-06-14 14:34:39--  https://repo.mysql.com//mysql80-community-release-el7-6.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 104.85.161.42
Connecting to repo.mysql.com (repo.mysql.com)|104.85.161.42|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11288 (11K) [application/x-redhat-package-manager]
Saving to: ‘mysql80-community-release-el7-6.noarch.rpm’

100%[==================================================================================================================================================>] 11,288      --.-K/s   in 0s      

2022-06-14 14:34:40 (448 MB/s) - ‘mysql80-community-release-el7-6.noarch.rpm’ saved [11288/11288]

[root@heavydb ~]# rpm -ivh mysql80-community-release-el7-6.noarch.rpm 
warning: mysql80-community-release-el7-6.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-6  ################################# [100%]
[root@heavydb ~]# yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
mysql-connectors-community                                                                                                                                           | 2.6 kB  00:00:00     
mysql-tools-community                                                                                                                                                | 2.6 kB  00:00:00     
mysql80-community                                                                                                                                                    | 2.6 kB  00:00:00     
(1/3): mysql-connectors-community/x86_64/primary_db                                                                                                                  |  87 kB  00:00:01     
(2/3): mysql-tools-community/x86_64/primary_db                                                                                                                       |  86 kB  00:00:01     
(3/3): mysql80-community/x86_64/primary_db                                                                                                                           | 211 kB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-icu-data-files = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-client-plugins = 8.0.29-1.el7 for package: mysql-community-client-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.29-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-client-plugins.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.29-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                                    Arch                               Version                                  Repository                                     Size
============================================================================================================================================================================================
Installing:
 mysql-community-server                                     x86_64                             8.0.29-1.el7                             mysql80-community                              53 M
Installing for dependencies:
 mysql-community-client                                     x86_64                             8.0.29-1.el7                             mysql80-community                              14 M
 mysql-community-client-plugins                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.5 M
 mysql-community-common                                     x86_64                             8.0.29-1.el7                             mysql80-community                             633 k
 mysql-community-icu-data-files                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.1 M
 mysql-community-libs                                       x86_64                             8.0.29-1.el7                             mysql80-community                             1.5 M

Transaction Summary
============================================================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 74 M
Installed size: 346 M
Is this ok [y/d/N]: y      
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY MB  00:02:10 ETA 
Public key for mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm is not installed
(1/6): mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm                                                                                                        | 2.5 MB  00:00:03     
(2/6): mysql-community-common-8.0.29-1.el7.x86_64.rpm                                                                                                                | 633 kB  00:00:00     
(3/6): mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm                                                                                                        | 2.1 MB  00:00:04     
(4/6): mysql-community-libs-8.0.29-1.el7.x86_64.rpm                                                                                                                  | 1.5 MB  00:00:05     
(5/6): mysql-community-client-8.0.29-1.el7.x86_64.rpm                                                                                                                |  14 MB  00:00:18     
(6/6): mysql-community-server-8.0.29-1.el7.x86_64.rpm                                                                                                                |  53 MB  00:00:42     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                       1.3 MB/s |  74 MB  00:00:56     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022


GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022"
[root@heavydb ~]# yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-icu-data-files = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-client-plugins = 8.0.29-1.el7 for package: mysql-community-client-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.29-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-client-plugins.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.29-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                                    Arch                               Version                                  Repository                                     Size
============================================================================================================================================================================================
Installing:
 mysql-community-server                                     x86_64                             8.0.29-1.el7                             mysql80-community                              53 M
Installing for dependencies:
 mysql-community-client                                     x86_64                             8.0.29-1.el7                             mysql80-community                              14 M
 mysql-community-client-plugins                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.5 M
 mysql-community-common                                     x86_64                             8.0.29-1.el7                             mysql80-community                             633 k
 mysql-community-icu-data-files                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.1 M
 mysql-community-libs                                       x86_64                             8.0.29-1.el7                             mysql80-community                             1.5 M

Transaction Summary
============================================================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total size: 74 M
Installed size: 346 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022


GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022"
[root@heavydb ~]# systemctl enable mysqld.service

Failed to execute operation: No such file or directory
[root@heavydb ~]# 
[root@heavydb ~]# systemctl enable mysqld.service
Failed to execute operation: No such file or directory
[root@heavydb ~]# 
[root@heavydb ~]# yum install mysql-community-server  --nogpgcheck
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-icu-data-files = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.29-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.29-1.el7 will be installed
--> Processing Dependency: mysql-community-client-plugins = 8.0.29-1.el7 for package: mysql-community-client-8.0.29-1.el7.x86_64
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.29-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-client-plugins.x86_64 0:8.0.29-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.29-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                                    Arch                               Version                                  Repository                                     Size
============================================================================================================================================================================================
Installing:
 mysql-community-server                                     x86_64                             8.0.29-1.el7                             mysql80-community                              53 M
Installing for dependencies:
 mysql-community-client                                     x86_64                             8.0.29-1.el7                             mysql80-community                              14 M
 mysql-community-client-plugins                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.5 M
 mysql-community-common                                     x86_64                             8.0.29-1.el7                             mysql80-community                             633 k
 mysql-community-icu-data-files                             x86_64                             8.0.29-1.el7                             mysql80-community                             2.1 M
 mysql-community-libs                                       x86_64                             8.0.29-1.el7                             mysql80-community                             1.5 M

Transaction Summary
============================================================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total size: 74 M
Installed size: 346 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-8.0.29-1.el7.x86_64                                                                                                                               1/6 
  Installing : mysql-community-client-plugins-8.0.29-1.el7.x86_64                                                                                                                       2/6 
  Installing : mysql-community-libs-8.0.29-1.el7.x86_64                                                                                                                                 3/6 
  Installing : mysql-community-client-8.0.29-1.el7.x86_64                                                                                                                               4/6 
  Installing : mysql-community-icu-data-files-8.0.29-1.el7.x86_64                                                                                                                       5/6 
  Installing : mysql-community-server-8.0.29-1.el7.x86_64                                                                                                                               6/6 
  Verifying  : mysql-community-icu-data-files-8.0.29-1.el7.x86_64                                                                                                                       1/6 
  Verifying  : mysql-community-client-8.0.29-1.el7.x86_64                                                                                                                               2/6 
  Verifying  : mysql-community-client-plugins-8.0.29-1.el7.x86_64                                                                                                                       3/6 
  Verifying  : mysql-community-server-8.0.29-1.el7.x86_64                                                                                                                               4/6 
  Verifying  : mysql-community-common-8.0.29-1.el7.x86_64                                                                                                                               5/6 
  Verifying  : mysql-community-libs-8.0.29-1.el7.x86_64                                                                                                                                 6/6 

Installed:
  mysql-community-server.x86_64 0:8.0.29-1.el7                                                                                                                                              

Dependency Installed:
  mysql-community-client.x86_64 0:8.0.29-1.el7                     mysql-community-client-plugins.x86_64 0:8.0.29-1.el7             mysql-community-common.x86_64 0:8.0.29-1.el7            
  mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7             mysql-community-libs.x86_64 0:8.0.29-1.el7                      

Complete!
[root@heavydb ~]# systemctl enable mysqld.service
[root@heavydb ~]# systemctl start mysqld.service
[root@heavydb ~]# grep 'temporary password' /var/log/mysqld.log
2022-06-14T06:38:06.357047Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: hcSysO2,qspp
[root@heavydb ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'abcd1234';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '1qazXSW@';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> 
mysql>  GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

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 user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> GRANT ALL ON *.* TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1qazXSW@';
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

mysql> 

2.修改data和log目录:

[root@heavydb ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

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

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@heavydb ~]# pwd
/root
[root@heavydb ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.8G     0  3.8G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G   12M  3.8G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   35G   30G  5.1G  86% /
/dev/sda1               1014M  151M  864M  15% /boot
tmpfs                    781M     0  781M   0% /run/user/0
[root@heavydb ~]# mkdir -p /mysql/data
[root@heavydb ~]# mkdir -p /mysql/log
[root@heavydb ~]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
[root@heavydb ~]# chown -R mysql:mysql /mysql
[root@heavydb ~]# vi /etc/my.conf

[root@heavydb ~]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

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

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
~
~
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

socket=/mysql/mysql.sock
"/etc/my.cnf" 31L, 1239C written
[root@heavydb ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/mysql/data
socket=/mysql/data/mysql.sock

log-error=/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@heavydb ~]# systemctl stop mysqld
[root@heavydb ~]# 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@heavydb ~]# ll /var/lib/mysql
total 176576
-rw-r-----. 1 mysql mysql       56 Jun 14 14:38 auto.cnf
-rw-r-----. 1 mysql mysql     2136 Jun 14 14:59 binlog.000001
-rw-r-----. 1 mysql mysql       16 Jun 14 14:38 binlog.index
-rw-------. 1 mysql mysql     1680 Jun 14 14:38 ca-key.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 14:38 ca.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 14:38 client-cert.pem
-rw-------. 1 mysql mysql     1680 Jun 14 14:38 client-key.pem
-rw-r-----. 1 mysql mysql   196608 Jun 14 14:46 #ib_16384_0.dblwr
-rw-r-----. 1 mysql mysql  8585216 Jun 14 14:38 #ib_16384_1.dblwr
-rw-r-----. 1 mysql mysql     3707 Jun 14 14:59 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Jun 14 14:59 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Jun 14 14:46 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Jun 14 14:38 ib_logfile1
drwxr-x---. 2 mysql mysql        6 Jun 14 14:59 #innodb_temp
drwxr-x---. 2 mysql mysql      143 Jun 14 14:38 mysql
-rw-r-----. 1 mysql mysql 25165824 Jun 14 14:46 mysql.ibd
drwxr-x---. 2 mysql mysql     8192 Jun 14 14:38 performance_schema
-rw-------. 1 mysql mysql     1680 Jun 14 14:38 private_key.pem
-rw-r--r--. 1 mysql mysql      452 Jun 14 14:38 public_key.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 14:38 server-cert.pem
-rw-------. 1 mysql mysql     1680 Jun 14 14:38 server-key.pem
drwxr-x---. 2 mysql mysql       28 Jun 14 14:38 sys
-rw-r-----. 1 mysql mysql 16777216 Jun 14 14:46 undo_001
-rw-r-----. 1 mysql mysql 16777216 Jun 14 14:46 undo_002
[root@heavydb ~]# cp -r /var/lib/mysql /mysql/data/
[root@heavydb ~]# 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@heavydb ~]# journalctl -xe
-- Subject: Unit mysqld.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun shutting down.
Jun 14 14:59:55 heavydb systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has finished shutting down.
Jun 14 14:59:55 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2234:241622 (system bus name :1.39, object path /org/freedesktop/PolicyKit1/Authent
Jun 14 15:00:00 heavydb polkitd[713]: Registered Authentication Agent for unix-process:2241:242236 (system bus name :1.40 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jun 14 15:00:00 heavydb systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.279814Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.279896Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 2322
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.282133Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.282139Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /mysql/data/ is 
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.282920Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/log/mysqld.log' for error logging: Permission d
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.283050Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 14 15:00:03 heavydb mysqld[2322]: 2022-06-14T07:00:03.283594Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Serve
Jun 14 15:00:03 heavydb systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun 14 15:00:03 heavydb systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 14 15:00:03 heavydb systemd[1]: Unit mysqld.service entered failed state.
Jun 14 15:00:03 heavydb systemd[1]: mysqld.service failed.
Jun 14 15:00:03 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2241:242236 (system bus name :1.40, object path /org/freedesktop/PolicyKit1/Authent
Jun 14 15:00:48 heavydb polkitd[713]: Registered Authentication Agent for unix-process:2327:247081 (system bus name :1.41 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jun 14 15:00:48 heavydb systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.978604Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.978715Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 2357
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.994386Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.994410Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /mysql/data/ is 
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.995201Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/log/mysqld.log' for error logging: Permission d
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.996525Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 14 15:00:48 heavydb mysqld[2357]: 2022-06-14T07:00:48.997042Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Serve
Jun 14 15:00:49 heavydb systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun 14 15:00:49 heavydb systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 14 15:00:49 heavydb systemd[1]: Unit mysqld.service entered failed state.
Jun 14 15:00:49 heavydb systemd[1]: mysqld.service failed.
Jun 14 15:00:49 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2327:247081 (system bus name :1.41, object path /org/freedesktop/PolicyKit1/Authent
[root@heavydb ~]# ll /mysql/data/
total 177596
-rw-r-----. 1 mysql mysql       56 Jun 14 15:00 auto.cnf
-rw-------. 1 mysql mysql     1676 Jun 14 15:00 ca-key.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 15:00 ca.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 15:00 client-cert.pem
-rw-------. 1 mysql mysql     1680 Jun 14 15:00 client-key.pem
-rw-r-----. 1 mysql mysql   196608 Jun 14 15:00 #ib_16384_0.dblwr
-rw-r-----. 1 mysql mysql  8585216 Jun 14 15:00 #ib_16384_1.dblwr
-rw-r-----. 1 mysql mysql     6009 Jun 14 15:00 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Jun 14 15:00 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Jun 14 15:00 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Jun 14 15:00 ib_logfile1
drwxr-x---. 2 mysql mysql        6 Jun 14 15:00 #innodb_temp
drwxr-x---. 6 mysql mysql     4096 Jun 14 15:00 mysql
-rw-r-----. 1 mysql mysql 26214400 Jun 14 15:00 mysql.ibd
drwxr-x---. 2 mysql mysql     8192 Jun 14 15:00 performance_schema
-rw-------. 1 mysql mysql     1680 Jun 14 15:00 private_key.pem
-rw-r--r--. 1 mysql mysql      452 Jun 14 15:00 public_key.pem
-rw-r--r--. 1 mysql mysql     1112 Jun 14 15:00 server-cert.pem
-rw-------. 1 mysql mysql     1676 Jun 14 15:00 server-key.pem
drwxr-x---. 2 mysql mysql       28 Jun 14 15:00 sys
-rw-r-----. 1 mysql mysql 16777216 Jun 14 15:00 undo_001
-rw-r-----. 1 mysql mysql 16777216 Jun 14 15:00 undo_002
[root@heavydb ~]# ll /mysql/log
total 4
-rw-r-----. 1 mysql mysql 457 Jun 14 15:00 mysqld.log
[root@heavydb ~]# cd /mysql/log/mysqld.log 
-bash: cd: /mysql/log/mysqld.log: Not a directory
[root@heavydb ~]# cd /mysql/log/m
-bash: cd: /mysql/log/m: No such file or directory
[root@heavydb ~]# cd /mysql/log/
[root@heavydb log]# more mysqld.log 
2022-06-14T07:00:00.063412Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 2273
2022-06-14T07:00:00.069119Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-06-14T07:00:00.228968Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-06-14T07:00:00.976403Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: hg/oN0j#uh1f
[root@heavydb log]# date
Tue Jun 14 15:02:42 CST 2022
[root@heavydb log]# ll /mysql/data/mysqld_tmp_file_case_insensitive_test
ls: cannot access /mysql/data/mysqld_tmp_file_case_insensitive_test: No such file or directory
[root@heavydb log]# systemctl stop mysqld
[root@heavydb log]# 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@heavydb log]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2022-06-14 15:03:37 CST; 7s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2418 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Process: 2394 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 2418 (code=exited, status=1/FAILURE)
   Status: "Server startup in progress"
    Error: 13 (Permission denied)

Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.092653Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 2418
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.094918Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_ins....lower-test
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.094923Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /m...insensitive
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.095625Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/log/mysqld.log' for error logging...sion denied
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.095708Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.096057Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL C...rver - GPL.
Jun 14 15:03:37 heavydb systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun 14 15:03:37 heavydb systemd[1]: Failed to start MySQL Server.
Jun 14 15:03:37 heavydb systemd[1]: Unit mysqld.service entered failed state.
Jun 14 15:03:37 heavydb systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@heavydb log]# ll /mysql/log/mysqld.log
-rw-r-----. 1 mysql mysql 457 Jun 14 15:00 /mysql/log/mysqld.log
[root@heavydb log]# ll /mysql
total 4
drwxr-xr-x. 6 mysql mysql 4096 Jun 14 15:00 data
drwxr-xr-x. 2 mysql mysql   24 Jun 14 15:00 log
[root@heavydb log]# ll /mysql/log
total 4
-rw-r-----. 1 mysql mysql 457 Jun 14 15:00 mysqld.log
[root@heavydb log]# chmod -R 755 /mysql/log
[root@heavydb log]# 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@heavydb log]# journalctl -xe
-- 
-- The start-up result is done.
Jun 14 15:01:01 heavydb CROND[2364]: (root) CMD (run-parts /etc/cron.hourly)
Jun 14 15:01:01 heavydb run-parts(/etc/cron.hourly)[2367]: starting 0anacron
Jun 14 15:01:01 heavydb anacron[2373]: Anacron started on 2022-06-14
Jun 14 15:01:01 heavydb run-parts(/etc/cron.hourly)[2375]: finished 0anacron
Jun 14 15:01:01 heavydb anacron[2373]: Will run job `cron.daily' in 41 min.
Jun 14 15:01:01 heavydb anacron[2373]: Will run job `cron.weekly' in 61 min.
Jun 14 15:01:01 heavydb anacron[2373]: Will run job `cron.monthly' in 81 min.
Jun 14 15:01:01 heavydb anacron[2373]: Jobs will be executed sequentially
Jun 14 15:03:32 heavydb polkitd[713]: Registered Authentication Agent for unix-process:2382:263480 (system bus name :1.44 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jun 14 15:03:32 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2382:263480 (system bus name :1.44, object path /org/freedesktop/PolicyKit1/Authent
Jun 14 15:03:36 heavydb polkitd[713]: Registered Authentication Agent for unix-process:2388:263919 (system bus name :1.45 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jun 14 15:03:36 heavydb systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.092583Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.092653Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 2418
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.094918Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.094923Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /mysql/data/ is 
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.095625Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/log/mysqld.log' for error logging: Permission d
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.095708Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 14 15:03:37 heavydb mysqld[2418]: 2022-06-14T07:03:37.096057Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Serve
Jun 14 15:03:37 heavydb systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun 14 15:03:37 heavydb systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 14 15:03:37 heavydb systemd[1]: Unit mysqld.service entered failed state.
Jun 14 15:03:37 heavydb systemd[1]: mysqld.service failed.
Jun 14 15:03:37 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2388:263919 (system bus name :1.45, object path /org/freedesktop/PolicyKit1/Authent
Jun 14 15:04:29 heavydb polkitd[713]: Registered Authentication Agent for unix-process:2426:269202 (system bus name :1.46 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jun 14 15:04:29 heavydb systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.908432Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.908520Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 2456
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.912796Z 0 [Warning] [MY-010091] [Server] Can't create test file /mysql/data/mysqld_tmp_file_case_insensitive_test.
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.912802Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /mysql/data/ is 
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.913472Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/log/mysqld.log' for error logging: Permission d
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.913562Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 14 15:04:29 heavydb mysqld[2456]: 2022-06-14T07:04:29.913950Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Serve
Jun 14 15:04:29 heavydb systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun 14 15:04:29 heavydb systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 14 15:04:29 heavydb systemd[1]: Unit mysqld.service entered failed state.
Jun 14 15:04:29 heavydb systemd[1]: mysqld.service failed.
Jun 14 15:04:29 heavydb polkitd[713]: Unregistered Authentication Agent for unix-process:2426:269202 (system bus name :1.46, object path /org/freedesktop/PolicyKit1/Authent
[root@heavydb log]# /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31
[root@heavydb log]# getenforce
Enforcing
[root@heavydb log]# vi /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted



# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
"/etc/selinux/config" 14L, 542C written
[root@heavydb log]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

[root@heavydb log]# setenforce 0
[root@heavydb log]# getenforce
Permissive
[root@heavydb log]# /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          disabled
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31
[root@heavydb log]# systemctl stop mysqld
[root@heavydb log]# rm -rf /mysql/data/*
[root@heavydb log]# mv /var/lib/mysql/* /mysql/data/
[root@heavydb log]# systemctl start mysqld
[root@heavydb log]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-06-14 15:09:37 CST; 4s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2487 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 2511 (mysqld)
   Status: "Server is operational"
   CGroup: /system.slice/mysqld.service
           └─2511 /usr/sbin/mysqld

Jun 14 15:09:36 heavydb systemd[1]: Starting MySQL Server...
Jun 14 15:09:37 heavydb systemd[1]: Started MySQL Server.
[root@heavydb log]# mysql -uroot -p1qazXSW@ 
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@heavydb log]# mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@heavydb log]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/mysql/data
socket=/mysql/data/mysql.sock

log-error=/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@heavydb log]# mysql -uroot -p --socket=/mysql/data/mysql.sock
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> \q
Bye
[root@heavydb log]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/mysql/data
socket=/mysql/data/mysql.sock

log-error=/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
~
~
[root@heavydb log]# systemctl restart mysqld
[root@heavydb log]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[client]
socket=/mysql/data/mysql.sock
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/mysql/data
socket=/mysql/data/mysql.sock

log-error=/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@heavydb log]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> show variables like 'data%';
+---------------+--------------+
| Variable_name | Value        |
+---------------+--------------+
| datadir       | /mysql/data/ |
+---------------+--------------+
1 row in set (0.00 sec)

mysql> show variables like 'log%';
+----------------------------------------+----------------------------------------+
| Variable_name                          | Value                                  |
+----------------------------------------+----------------------------------------+
| log_bin                                | ON                                     |
| log_bin_basename                       | /mysql/data/binlog                     |
| log_bin_index                          | /mysql/data/binlog.index               |
| log_bin_trust_function_creators        | OFF                                    |
| log_bin_use_v1_row_events              | OFF                                    |
| log_error                              | /mysql/log/mysqld.log                  |
| log_error_services                     | log_filter_internal; log_sink_internal |
| log_error_suppression_list             |                                        |
| log_error_verbosity                    | 2                                      |
| log_output                             | FILE                                   |
| log_queries_not_using_indexes          | OFF                                    |
| log_raw                                | OFF                                    |
| log_replica_updates                    | ON                                     |
| log_slave_updates                      | ON                                     |
| log_slow_admin_statements              | OFF                                    |
| log_slow_extra                         | OFF                                    |
| log_slow_replica_statements            | OFF                                    |
| log_slow_slave_statements              | OFF                                    |
| log_statements_unsafe_for_binlog       | ON                                     |
| log_throttle_queries_not_using_indexes | 0                                      |
| log_timestamps                         | UTC                                    |
+----------------------------------------+----------------------------------------+
21 rows in set (0.00 sec)

mysql> \q
Bye


最后修改时间:2022-06-14 15:26:48
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论