RPM方式安装mysql

下载离线版本mysql。

mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar

解压

 26468960 Dec 11  2020 mysql-community-client-5.7.33-1.el7.x86_64.rpm315280 Dec 11  2020 mysql-community-common-5.7.33-1.el7.x86_64.rpm3918736 Dec 11  2020 mysql-community-devel-5.7.33-1.el7.x86_64.rpm47513604 Dec 11  2020 mysql-community-embedded-5.7.33-1.el7.x86_64.rpm23261952 Dec 11  2020 mysql-community-embedded-compat-5.7.33-1.el7.x86_64.rpm
131045776 Dec 11  2020 mysql-community-embedded-devel-5.7.33-1.el7.x86_64.rpm2458780 Dec 11  2020 mysql-community-libs-5.7.33-1.el7.x86_64.rpm1260364 Dec 11  2020 mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm
181817592 Dec 11  2020 mysql-community-server-5.7.33-1.el7.x86_64.rpm
125021984 Dec 11  2020 mysql-community-test-5.7.33-1.el7.x86_64.rpm

安装

# sudo rpm -ivh mysql-com*.rpm
warning: mysql-community-client-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:mariadb-libs is obsoleted by mysql-community-libs-5.7.33-1.el7.x86_64mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.33-1.el7.x86_64perl(JSON) is needed by mysql-community-test-5.7.33-1.el7.x86_64

因为mysql的server端须要perl语言的支持,所以咱们还须要在系统中安装perl支持:

安装依赖perl

# sudo yum install perl -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
base                                                                                                                                       | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                           | 3.5 kB  00:00:00     
extras                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                    | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package perl.x86_64 4:5.16.3-297.el7 will be updated
---> Package perl.x86_64 4:5.16.3-299.el7_9 will be an update
--> Processing Dependency: perl-libs = 4:5.16.3-299.el7_9 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Running transaction check
---> Package perl-libs.x86_64 4:5.16.3-297.el7 will be updated
---> Package perl-libs.x86_64 4:5.16.3-299.el7_9 will be an update
--> Finished Dependency ResolutionDependencies Resolved==================================================================================================================================================================Package                              Arch                              Version                                          Repository                          Size
==================================================================================================================================================================
Updating:perl                                 x86_64                            4:5.16.3-299.el7_9                               updates                            8.0 M
Updating for dependencies:perl-libs                            x86_64                            4:5.16.3-299.el7_9                               updates                            690 kTransaction Summary
==================================================================================================================================================================
Upgrade  1 Package (+1 Dependent package)Total download size: 8.6 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): perl-libs-5.16.3-299.el7_9.x86_64.rpm                                                                                               | 690 kB  00:00:02     
(2/2): perl-5.16.3-299.el7_9.x86_64.rpm                                                                                                    | 8.0 MB  00:00:21     
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                             416 kB/s | 8.6 MB  00:00:21     
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionUpdating   : 4:perl-libs-5.16.3-299.el7_9.x86_64                                                                                                            1/4 Updating   : 4:perl-5.16.3-299.el7_9.x86_64                                                                                                                 2/4 Cleanup    : 4:perl-libs-5.16.3-297.el7.x86_64                                                                                                              3/4 Cleanup    : 4:perl-5.16.3-297.el7.x86_64                                                                                                                   4/4 Verifying  : 4:perl-5.16.3-299.el7_9.x86_64                                                                                                                 1/4 Verifying  : 4:perl-libs-5.16.3-299.el7_9.x86_64                                                                                                            2/4 Verifying  : 4:perl-5.16.3-297.el7.x86_64                                                                                                                   3/4 Verifying  : 4:perl-libs-5.16.3-297.el7.x86_64                                                                                                              4/4 Updated:perl.x86_64 4:5.16.3-299.el7_9                                                                                                                                  Dependency Updated:perl-libs.x86_64 4:5.16.3-299.el7_9                                                                                                                             Complete!

一条条安装

# sudo rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/english/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/german/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/greek/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/italian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/japanese/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/korean/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/polish/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/romanian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/russian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/serbian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/slovak/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/spanish/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/swedish/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/Index.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/armscii8.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/ascii.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp1250.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp1251.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp1256.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp1257.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp850.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp852.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/cp866.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/dec8.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/geostd8.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/greek.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/hebrew.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/hp8.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/keybcs2.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/koi8r.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/koi8u.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/latin1.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/latin2.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/latin5.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/latin7.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/macce.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/macroman.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64file /usr/share/mysql/charsets/swe7.xml from install of mysql-community-common-5.7.33-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64

这是跟mariadb-libs 冲突了,如果确定没有使用mariadb-libs,yum remove 卸载掉。

安装冲突,解决冲突

# yum info mariadb*
Loaded plugins: fastestmirror
Skipping unreadable repository '/etc/yum.repos.d/Centos-7.repo'
Determining fastest mirrors
docker-ce-stable                                                                                                                                                   | 3.5 kB  00:00:00     
(1/2): docker-ce-stable/7/x86_64/updateinfo                                                                                                                        |   55 B  00:00:00     
(2/2): docker-ce-stable/7/x86_64/primary_db                                                                                                                        | 152 kB  00:00:00     
Installed Packages
Name        : mariadb-libs
Arch        : x86_64
Epoch       : 1
Version     : 5.5.68
Release     : 1.el7
Size        : 4.4 M
Repo        : installed
From repo   : anaconda
Summary     : The shared libraries required for MariaDB/MySQL clients
URL         : http://mariadb.org
License     : GPLv2 with exceptions and LGPLv2 and BSD
Description : The mariadb-libs package provides the essential shared libraries for any: MariaDB/MySQL client program or interface. You will need to install this: package to use any other MariaDB package or any clients that need to connect: to a MariaDB/MySQL server. MariaDB is a community developed branch of MySQL.

卸载冲突插件

# sudo yum -y remove mariadb-libs
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: 1:net-snmp-agent-libs-5.7.2-49.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:net-snmp-5.7.2-49.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 1:net-snmp-agent-libs-5.7.2-49.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: mysql-libs for package: 1:net-snmp-5.7.2-49.el7.x86_64
--> Running transaction check
---> Package net-snmp.x86_64 1:5.7.2-49.el7 will be erased
---> Package net-snmp-agent-libs.x86_64 1:5.7.2-49.el7 will be erased
---> Package postfix.x86_64 2:2.10.1-9.el7 will be erased
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================================================================================Package                                            Arch                                  Version                                         Repository                                 Size
==========================================================================================================================================================================================
Removing:mariadb-libs                                       x86_64                                1:5.5.68-1.el7                                  @anaconda                                 4.4 M
Removing for dependencies:net-snmp                                           x86_64                                1:5.7.2-49.el7                                  @loc-cdrom                                850 knet-snmp-agent-libs                                x86_64                                1:5.7.2-49.el7                                  @loc-cdrom                                2.1 Mpostfix                                            x86_64                                2:2.10.1-9.el7                                  @anaconda                                  12 MTransaction Summary
==========================================================================================================================================================================================
Remove  1 Package (+3 Dependent packages)Installed size: 20 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionErasing    : 1:net-snmp-5.7.2-49.el7.x86_64                                                                                                                                         1/4 
warning: /etc/sysconfig/snmpd saved as /etc/sysconfig/snmpd.rpmsave
warning: /etc/snmp/snmpd.conf saved as /etc/snmp/snmpd.conf.rpmsaveErasing    : 1:net-snmp-agent-libs-5.7.2-49.el7.x86_64                                                                                                                              2/4 Erasing    : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                          3/4 Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                     4/4 Verifying  : 1:net-snmp-5.7.2-49.el7.x86_64                                                                                                                                         1/4 Verifying  : 1:net-snmp-agent-libs-5.7.2-49.el7.x86_64                                                                                                                              2/4 Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                     3/4 Verifying  : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                          4/4 Removed:mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                                                                      Dependency Removed:net-snmp.x86_64 1:5.7.2-49.el7                            net-snmp-agent-libs.x86_64 1:5.7.2-49.el7                            postfix.x86_64 2:2.10.1-9.el7                           Complete!

重新rpm -ivh xx.rpm

# sudo rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-common-5.7.33-1.e################################# [100%]# sudo rpm -ivh mysql-community-libs-
mysql-community-libs-5.7.33-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm# sudo rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm 
warning: mysql-community-libs-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-libs-5.7.33-1.el7################################# [100%]# sudo rpm -ivh mysql-community-client-5.7.33-1.el7.x86_64.rpm 
warning: mysql-community-client-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-client-5.7.33-1.e################################# [100%]# sudo rpm -ivh mysql-community-server-5.7.33-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-server-5.7.33-1.e################################# [100%]

启动与检查

# systemctl start mysqld
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ===# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2024-07-04 14:12:38 CST; 3s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 28604 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 28371 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 28607 (mysqld)Tasks: 27Memory: 297.6MCGroup: /system.slice/mysqld.service└─28607 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

查找初始密码

# sudo grep 'temporary' /var/log/mysqld.log 
2024-07-04T06:12:30.791185Z 1 [Note] A temporary password is generated for root@localhost: WOoB<rtXW5qo
2024-07-04T06:12:37.291448Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

登陆mysql

# mysql -uroot -p'WOoB<rtXW5qo'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.33Copyright (c) 2000, 2021, 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> 

修改root密码,

mysql> set password = password('xxx');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set password = password('xxxxxxxxxxx');
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> exit
Bye

并设置可远程访问

mysql> grant all privileges on *.* to root@'%' identified by 'ddddddd' with grant option;
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

检查mysql.user

mysql> select user,host,authentication_string from mysql.user;
+---------------+-----------+-------------------------------------------+
| user          | host      | authentication_string                     |
+---------------+-----------+-------------------------------------------+
| root          | localhost | *B695B6F7FED8C46D8F21663E20B4E0BA549BCEEA |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys     | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| root          | %         | *B695B6F7FED8C46D8F21663E20B4E0BA549BCEEA |
+---------------+-----------+-------------------------------------------+
4 rows in set (0.01 sec)

安装完mysql后,修改data目录

my.cnf默认文件位置

# ll /etc/my.cnf
-rw-r--r-- 1 root root 960 Dec 10  2020 /etc/my.cnf

data默认文件位置

# ll /var/lib/mysql
total 122952
-rw-r----- 1 mysql mysql       56 Jul  4 14:12 auto.cnf
-rw------- 1 mysql mysql     1676 Jul  4 14:12 ca-key.pem
-rw-r--r-- 1 mysql mysql     1112 Jul  4 14:12 ca.pem
-rw-r--r-- 1 mysql mysql     1112 Jul  4 14:12 client-cert.pem
-rw------- 1 mysql mysql     1680 Jul  4 14:12 client-key.pem
-rw-r----- 1 mysql mysql      436 Jul  4 14:12 ib_buffer_pool
-rw-r----- 1 mysql mysql 12582912 Jul  4 14:12 ibdata1
-rw-r----- 1 mysql mysql 50331648 Jul  4 14:12 ib_logfile0
-rw-r----- 1 mysql mysql 50331648 Jul  4 14:12 ib_logfile1
-rw-r----- 1 mysql mysql 12582912 Jul  4 14:12 ibtmp1
drwxr-x--- 2 mysql mysql     4096 Jul  4 14:12 mysql
srwxrwxrwx 1 mysql mysql        0 Jul  4 14:12 mysql.sock
-rw------- 1 mysql mysql        6 Jul  4 14:12 mysql.sock.lock
drwxr-x--- 2 mysql mysql     8192 Jul  4 14:12 performance_schema
-rw------- 1 mysql mysql     1676 Jul  4 14:12 private_key.pem
-rw-r--r-- 1 mysql mysql      452 Jul  4 14:12 public_key.pem
-rw-r--r-- 1 mysql mysql     1112 Jul  4 14:12 server-cert.pem
-rw------- 1 mysql mysql     1680 Jul  4 14:12 server-key.pem
drwxr-x--- 2 mysql mysql     8192 Jul  4 14:12 sys

停止mysql

# systemctl stop mysqld# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead) since Thu 2024-07-04 15:23:36 CST; 4s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 28604 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 28371 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 28607 (code=exited, status=0/SUCCESS)Jul 04 14:12:17 host-10-15-32-71 systemd[1]: Starting MySQL Server...
Jul 04 14:12:38 host-10-15-32-71 systemd[1]: Started MySQL Server.
Jul 04 15:23:34 host-10-15-32-71 systemd[1]: Stopping MySQL Server...
Jul 04 15:23:36 host-10-15-32-71 systemd[1]: Stopped MySQL Server.

复制原数据到新目录

# cp -R /var/lib/mysql /data/datamysql/

修改my.cnf,指定新目录

datadir=/data/datamysql/mysql

启动mysql

# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2024-07-04 15:32:35 CST; 13min agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 27299 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 27275 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 27301 (mysqld)Tasks: 28Memory: 193.9MCGroup: /system.slice/mysqld.service└─27301 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/41335.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Redis基础教程(十四):Redis连接

&#x1f49d;&#x1f49d;&#x1f49d;首先&#xff0c;欢迎各位来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里不仅可以有所收获&#xff0c;同时也能感受到一份轻松欢乐的氛围&#xff0c;祝你生活愉快&#xff01; &#x1f49d;&#x1f49…

通过装饰器将有BUG的pytorch算子放置在CPU上,而不用修改模型代码

通过装饰器将有BUG的pytorch算子放置在CPU上,而不用修改模型代码 1.代码 某些pytorch算子发下到设备后会导致设备异常,为了暂时规避,先放在CPU上执行 修改模型源码很不友好,可以采用以下方法 1.代码 def force_cpu(func):def wrapper(self, *args, **kwargs):self_cpu self.…

在Windows可以如此丝滑的测试ios应用

在没有Mac本的时候,又想测试iphone或者ipad该怎么办? 最简单的办法当然是买一个了,如果经济上觉得不划算的话,不妨看看这篇文章,或许能帮到您,有任何问题欢迎一起交流。 原理图 开发环境 操作系统:Windows11 被测设备: iPad mini 15.5 注意事项 一定要安装iTunes!一…

NET程序开发可能会用到的一些资料文档

NET程序开发使用的一些资料文件&#xff0c;NET高级调试&#xff0c;NET关键技术深入解析&#xff0c;WPF专业编程指南&#xff0c;程序员求职攻略&#xff0c;WPF编程宝典等。 下载链接&#xff1a;https://download.csdn.net/download/qq_43307934/89518582

GPT-4o将改变论文学术文风,科学家揭示5年内百万篇论文“is”“are”词频减少10%!

在最近的一项研究中&#xff0c;意大利国际高等研究院&#xff08;SISSA&#xff09;的博士生耿明萌量化了 ChatGPT 对学术论文写作的影响。 与以往主要分析 ChatGPT 生成的段落或文章不同&#xff0c;这次研究更关注整体情况。 论文地址&#xff1a;https://arxiv.org/pdf/2…

如何在Vue中添加事件监听器

在Vue中添加事件监听器主要有两种方式&#xff1a;在模板中直接添加和使用Vue实例的方法。以下将详细解释这两种方法。 1. 在模板中直接添加 在Vue的模板中&#xff0c;你可以直接在HTML元素上使用v-on指令&#xff08;或其简写形式&#xff09;来监听DOM事件&#xff0c;并在…

SpringBoot怎么单独关闭某个类打印出来的日志?

application.yml文件增加以下内容&#xff1a; logging:level:org.springframework.amgp.rabbit: OFF 配置logging:level是配置的什么&#xff1f; 在application.yml文件中配置logging.level是用来设置日志级别的。这是Spring Boot应用中的一个常用配置&#xff0c;它允许您…

go内存返还系统相关代码

在go中内存返还系统相关代码主要由sysUnusedOS实现 在Linux中默认是通过madvice方法的_MADV_FREE进行释放&#xff0c;在这种释放中内存其实是被延迟回收的。 func sysUnusedOS(v unsafe.Pointer, n uintptr) {if uintptr(v)&(physPageSize-1) ! 0 || n&(physPageSiz…

Spring AOP实现操作日志记录示例

1. 准备工作 项目环境&#xff1a;jdk8springboot2.6.13mysql8 1.1 MySQL表 /*Navicat Premium Data TransferSource Server : localhostSource Server Type : MySQLSource Server Version : 50730Source Host : 127.0.0.1:3306Source Schema …

双扩散金属氧化物半导体(DMOS)应用广泛 超结VDMOS市场需求空间大

双扩散金属氧化物半导体&#xff08;DMOS&#xff09;应用广泛 超结VDMOS市场需求空间大 双扩散金属氧化物半导体简称DMOS&#xff0c;是MOS管的一种。MOS管全称为金属氧化物半导体场效应管&#xff0c;又称为MOSFET&#xff0c;是一种利用改变电压来控制电流的半导体器件。  …

《梦醒蝶飞:释放Excel函数与公式的力量》8.8 STDEVP函数

8.8 STDEVP函数 STDEVP函数是Excel中用于计算总体数据的标准偏差的函数。标准偏差是统计学中的一个重要指标&#xff0c;用于衡量数据集中各数值偏离平均值的程度。总体标准偏差考虑了整个数据集&#xff0c;而不是样本。 8.8.1 函数简介 STDEVP函数用于返回总体数据的标准偏…

2023年工作回顾与总结

一、工作概述 主要工作职责和任务 完善XXX平台的基础能力优化XXX平台基础架构负责平台小组代码评审负责复杂功能的提供技术支持负责复杂功能的技术方案评审负责XXX国家项目中平台相关项目通过验收 具体内容和完成情况 XX平台架构优化 &#xff08;1&#xff09;完成通用控…

Redis 中的通用命令(命令的返回值、复杂度、注意事项及操作演示)

Redis 中的通用命令(高频率操作) 文章目录 Redis 中的通用命令(高频率操作)Redis 的数据类型redis-cli 命令Keys 命令Exists 命令Expire 命令Ttl 命令Type命令 Redis 的数据类型 Redis 支持多种数据类型&#xff0c;整体来说&#xff0c;Redis 是一个键值对结构的&#xff0c;…

第N7周:seq2seq翻译实战-pytorch复现-小白版

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 理论基础 seq2seq&#xff08;Sequence-to-Sequence&#xff09;模型是一种用于机器翻译、文本摘要等序列转换任务的框架。它由两个主要的递归神经网络&#…

【leetcode】双指针算法题

文章目录 1.算法思想2.移动零3.复写零方法一方法二 4.快乐数5.盛水最多的容器方法一&#xff08;暴力求解&#xff09;方法二&#xff08;左右指针&#xff09; 6.有效三角形的个数方法一&#xff08;暴力求解&#xff09;方法二&#xff08;左右指针&#xff09; 7.两数之和8.…

CNN文献综述

卷积神经网络&#xff08;Convolutional Neural Networks&#xff0c;简称CNN&#xff09;是深度学习领域中的一种重要模型&#xff0c;主要用于图像识别和计算机视觉任务。其设计灵感来自于生物学中视觉皮层的工作原理&#xff0c;能够高效地处理图像和语音等数据。 基本原理…

UVa1265/LA4848 Tour Belt

UVa1265/LA4848 Tour Belt 题目链接题意分析AC 代码 题目链接 本题是2010年icpc亚洲区域赛大田赛区的F题 题意 给出一个有n个结点m条边的加权无向图G&#xff08;2≤n≤5000&#xff0c;1≤m≤n(n-1)/2&#xff09;&#xff0c;满足如下条件的结点集B&#xff08;2≤|B|≤n&am…

剪画小程序:手机制作音乐串烧,用它,真的很简单!

Hello&#xff0c;大家好呀&#xff0c;我是不会画画的小画。 相伴关注歌手的小伙伴们&#xff0c;上周五的《歌手 2024》第八期大家看了吧&#xff01;那期节目里有好几首歌都让我沉醉其中&#xff0c;像汪苏泷的《听见下雨的声音》、谭维维的《兰花花儿》等等。 为了能让大…

c++之旅第十一弹——顺序表

大家好啊&#xff0c;这里是c之旅第十一弹&#xff0c;跟随我的步伐来开始这一篇的学习吧&#xff01; 如果有知识性错误&#xff0c;欢迎各位指正&#xff01;&#xff01;一起加油&#xff01;&#xff01; 创作不易&#xff0c;希望大家多多支持哦&#xff01; 一,数据结构…

基于docker环境及Harbor部署{很简短一点了,耐心看吧}

用到的环境&#xff1a; docker 、nacos、compose、harbor&#xff08;自行安装 ,以下连接作为参考&#xff09; nacos&#xff1a;史上最全整合nacos单机模式整合哈哈哈哈哈_nacos 源码启动 单机模式-CSDN博客 docker、compose、harbor:史上最全的整合Harbor安装教程&#…