MySQL(一)

简介

MySQL是一个关系型数据库管理系统,由瑞典 Mysql AB 公司开发,属于 Oracle 旗下产品。MySQL 是最流行的关系型数据库管理系统之一。

安装部署

yum源安装

[root@wenzi ~]# ls
anaconda-ks.cfg  mysql80-community-release-el7-10.noarch.rpm  original-ks.cfg
[root@wenzi ~]# yum -y install mysql80-community-release-el7-10.noarch.rpm
[root@wenzi ~]# ls /etc/yum.repos.d/
backup  CentOS-Base.repo  epel.repo  epel-testing.repo  mysql-community-debuginfo.repo  mysql-community.repo  mysql-community-source.repo
[root@wenzi ~]# yum -y install epel-release
[root@wenzi ~]# yum -y info  mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: ftp.iij.ad.jp* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
Installed Packages
Name        : mysql-community-server
Arch        : x86_64
Version     : 8.0.34
Release     : 1.el7
Size        : 295 M
Repo        : installed
From repo   : mysql80-community
Summary     : A very fast and reliable SQL database server
URL         : http://www.mysql.com/
License     : Copyright (c) 2000, 2023, Oracle and/or its affiliates. Under GPLv2 license as shown in the Description field.
Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,: and robust SQL (Structured Query Language) database server. MySQL Server: is intended for mission-critical, heavy-load production systems as well: as for embedding into mass-deployed software. MySQL is a trademark of: Oracle and/or its affiliates:: The MySQL software has Dual Licensing, which means you can use the MySQL: software free of charge under the GNU General Public License: (http://www.gnu.org/licenses/). You can also purchase commercial MySQL: licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of: the GPL. See the chapter "Licensing and Support" in the manual for: further info.:: The MySQL web site (http://www.mysql.com/) provides the latest news and: information about the MySQL software.  Also please see the documentation: and the manual for more information.:: This package includes the MySQL server binary as well as related utilities: to run and administer a MySQL server.[root@wenzi ~]# yum -y install mysql-community-server
[root@wenzi ~]# systemctl start mysqld

修改密码

#查看默认密码
[root@wenzi ~]# grep "password" /var/log/mysqld.log
2023-09-04T17:54:42.391661Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: xax<ayT_e9Zs[root@wenzi ~]# mysql -uroot -p'xax<ayT_e9Zs'
#修改root密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin.123';
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye#使用新密码登录
[root@wenzi ~]# mysql -uroot -p'Admin.123'
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 10
Server version: 8.0.34 MySQL Community Server - GPL
...

二进制安装

官方文档 MySQL :: MySQL 8.1 Reference Manual :: 2.2 Installing MySQL on Unix/Linux Using Generic Binaries

通用Unix/Linux二进制包MySQL安装布局

目录目录内容
binmysqld server, client 和实用程序
docsMySQL info格式手册
manUnix 手册页
include包括头文件
lib
share错误消息、字典和用于数据库安装的SQL
support-files杂项支持文件
[root@wenzi ~]# ls
mysql-8.0.34-linux-glibc2.28-x86_64.tar.gz
#MySQL依赖libaio库
[root@wenzi ~]# yum search libaio
[root@wenzi ~]# yum -y install libaio
[root@wenzi ~]# tar -zx -f mysql-8.0.34-linux-glibc2.28-x86_64.tar.gz -C /usr/local/
[root@wenzi ~]# ln -s /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/ /usr/local/mysql
[root@wenzi ~]# ls /usr/local/mysql
bin  docs  include  lib  LICENSE  man  README  share  support-files
#创建mysql专用用户和组
[root@wenzi ~]# groupadd mysql
[root@wenzi ~]# useradd -r -g mysql -s /bin/false mysql
#删除系统自带的mysql或mariadb的配置文件,以免影响后续安装
[root@wenzi mysql]# rm -f /etc/my.cnf
#配置环境变量
[root@wenzi ~]# vim /etc/profile.d/mysql80.sh
export PATH=$PATH:/usr/local/mysql/bin
[root@wenzi ~]# source /etc/profile.d/mysql80.sh
[root@wenzi ~]# cd /usr/local/mysql/
#这个文件必须有,暂时不知作用
[root@wenzi mysql]# mkdir mysql-files
[root@wenzi mysql]# chown mysql:mysql mysql-files
[root@wenzi mysql]# chmod 750 mysql-files
[root@wenzi mysql]# chown -R mysql:mysql /usr/local/mysql/
#初始化
[root@wenzi mysql]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by mysqld)
mysqld: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by mysqld)
mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by mysqld)
mysqld: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libcrypto.so.3)
mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)

出现报错,大致意思说找不到相应版本的glibc,错误信息中glibc版本最高位2.28;查看现在系统glibc版本

#现系统上所有的glibc版本,可见最高为2.17,不满足条件,和报错信息符合
[root@wenzi ~]# strings /lib64/libc.so.6 | grep "GLIBC"
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE
...
[root@wenzi mysql]# yum info glibc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: mirrors.bfsu.edu.cn* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
#已安装的版本
Installed Packages
Name        : glibc
Arch        : x86_64
Version     : 2.17
Release     : 317.el7
Size        : 13 M
Repo        : installed
From repo   : anaconda
Summary     : The GNU libc libraries
URL         : http://www.gnu.org/software/glibc/
License     : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc package contains standard libraries which are used by: multiple programs on the system. In order to save disk space and: memory, as well as to make upgrading easier, common system code is: kept in one place and shared between programs. This particular package: contains the most important sets of shared libraries: the standard C: library and the standard math library. Without these two libraries, a: Linux system will not function.

去下载glibc_2.28,地址 Index of /gnu/glibc ,编译安装glibc2.28

[root@wenzi ~]# curl -O http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.xz
[root@wenzi ~]# tar -Jx -f glibc-2.28.tar.xz -C  /usr/local/
[root@wenzi ~]# mkdir /usr/local/glibc-2.28/build
[root@wenzi ~]# cd /usr/local/glibc-2.28/build
[root@wenzi build]# ../configure --prefix=/usr/ --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/glibc-2.28/build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

出现报错,在$PATH中找不到可接受的C编译器,查看日志 cat config.log

应该与gcc有关,查看本机是否安装gcc

安装gcc

[root@wenzi build]# yum -y install gcc
[root@wenzi build]# ../configure --prefix=/usr/ --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking whether g++ can link programs... no
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64 checking whether gcc compiles in -mx32 mode by default... nochecking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking if compiler warns about alias for function with incompatible types... no
checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64/multiarch sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /usr/bin/as is GNU as... yes
checking whether /usr/bin/ld is GNU ld... yes
checking for /usr/bin/as... /usr/bin/as
checking version of /usr/bin/as... 2.27, ok
checking for /usr/bin/ld... /usr/bin/ld
checking version of /usr/bin/ld... 2.27, ok
checking for gnumake... no
checking for gmake... gmake
checking version of gmake... 3.82, bad
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.8.1, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.2, ok
checking for gawk... gawk
checking version of gawk... 4.0.2, ok
checking for bison... no
checking if gcc -B/usr/bin/ is sufficient to build libc... no
checking for nm... nm
checking for python3... no
checking for python... python
configure: error:
*** These critical programs are missing or too old: make bison compiler
*** Check the INSTALL file for required versions.

出现报错,这些关键的程序要么缺少,要么太老了:make bison编译器;检查INSTALL文件以获取所需的版本。

下载make,地址 Index of /gnu/make

[root@wenzi ~]# curl -O https://ftp.gnu.org/gnu/make/make-4.2.tar.gz
[root@wenzi ~]# ls
anaconda-ks.cfg  glibc-2.28.tar.xz  make-4.2.tar.gz  mysql-8.0.34-linux-glibc2.28-x86_64.tar.gz  original-ks.cfg
[root@wenzi ~]# tar -xzvf make-4.2.tar.gz
[root@wenzi ~]# cd make-4.2
[root@wenzi make-4.2]# ls
ABOUT-NLS      ChangeLog     configure.bat  function.c       hash.c       Makefile.ami              NMakefile       README.OS2      strcache.c                  vmsify.c
acinclude.m4   commands.c    COPYING        getloadavg.c     hash.h       makefile.com              os.h            README.VMS      subproc.bat                 vmsjobs.c
aclocal.m4     commands.h    debug.h        getopt1.c        implicit.c   Makefile.DOS              output.c        README.W32      tests                       vms_progname.c
alloca.c       config        default.c      getopt.c         INSTALL      Makefile.in               output.h        remake.c        variable.c                  vpath.c
amiga.c        config.ami    dep.h          getopt.h         job.c        makefile.vms              po              remote-cstms.c  variable.h                  w32
amiga.h        configh.dos   dir.c          gettext.h        job.h        makeint.h                 posixos.c       remote-stub.c   version.c
ar.c           config.h.in   doc            glob             loadapi.c    make.lnk                  read.c          rule.c          vmsdir.h
arscan.c       config.h-vms  dosbuild.bat   gmk-default.h    load.c       make_msvc_net2003.sln     README          rule.h          vms_exit.c
AUTHORS        config.h.W32  expand.c       gmk-default.scm  main.c       make_msvc_net2003.vcproj  README.Amiga    SCOPTIONS       vms_export_symbol.c
build.sh.in    configure     file.c         gnumake.h        make.1       misc.c                    README.customs  signame.c       vms_export_symbol_test.com
build_w32.bat  configure.ac  filedef.h      guile.c          Makefile.am  NEWS                      README.DOS      SMakefile       vmsfunctions.c
[root@wenzi make-4.2]# ./configure
[root@wenzi make-4.2]# make
[root@wenzi make-4.2]# make install
[root@wenzi make-4.2]# rm -rf /usr/bin/make
[root@wenzi make-4.2]# cp ./make /usr/bin/
[root@wenzi make-4.2]# make -v
GNU Make 4.2
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.[root@wenzi ~]# yum -y install bison

再次编译安装glibc2.28

[root@wenzi ~]# cd /usr/local/glibc-2.28/build/
[root@wenzi build]# ../configure --prefix=/usr/ --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking whether g++ can link programs... no
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64 checking whether gcc compiles in -mx32 mode by default... nochecking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking if compiler warns about alias for function with incompatible types... no
checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64/multiarch sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /usr/bin/as is GNU as... yes
checking whether /usr/bin/ld is GNU ld... yes
checking for /usr/bin/as... /usr/bin/as
checking version of /usr/bin/as... 2.27, ok
checking for /usr/bin/ld... /usr/bin/ld
checking version of /usr/bin/ld... 2.27, ok
checking for gnumake... no
checking for gmake... gmake
checking version of gmake... 4.2, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.8.1, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.2, ok
checking for gawk... gawk
checking version of gawk... 4.0.2, ok
checking for bison... bison
checking version of bison... 3.0.4, ok
checking if gcc -B/usr/bin/ is sufficient to build libc... no
checking for nm... nm
checking for python3... no
checking for python... python
configure: error:
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.

出现报错,gcc版本太旧,升级gcc

[root@wenzi build]# yum -y install centos-release-scl
[root@wenzi build]# yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
[root@wenzi build]# scl enable devtoolset-8 bash
[root@wenzi build]# source /opt/rh/devtoolset-8/enable
[root@wenzi build]# echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile
[root@wenzi build]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr --mandir=/opt/rh/devtoolset-8/root/usr/share/man --infodir=/opt/rh/devtoolset-8/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-8.3.1-20190311/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)

以上排错过程参考 解决/lib64/libc.so.6: version `GLIBC_2.28‘ not found (required by_version `glibc_2.28' not found_LLLLLL_03的博客-CSDN博客

再次编译安装glibc2.28

[root@wenzi build]# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
[root@wenzi build]# make
[root@wenzi build]# make install
...
LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /usr/local/glibc-2.28/build/
/usr/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status
Execution of gcc -B/usr/bin/ failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading fromLinux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,libm.so should point to the newly installed glibc file - and there should beonly one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/usr/local/glibc-2.28'
make: *** [Makefile:12: install] Error 2

出现报错,未能解决,但查到有人说报错可以无视。CentOS 7.6 编译安装最新版本glibc2.30 实录-阿里云开发者社区

继续MySQL初始化

[root@wenzi build]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by mysqld)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)

出现报错,但关于glibc版本的错误消失了。

第一行错误通常是由于两个不兼容的库版本导致的。CXXABI_1.3.11是libstdc++.so.6库中的一个符号版本。当程序在运行时,动态链接器会尝试寻找并加载符号版本所对应的库。如果找不到或者找到的版本不匹配,就会出现链接错误。

错误信息中 CXXABI相关最高版本为CXXABI_1.3.11

查看本机有无对应版本,本机CXXABI最高为1.3.7

[root@wenzi ~]# strings /usr/lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

查询libstdc++.so.6本机位置

[root@wenzi ~]# find / -name libstdc++.so.6* #ls -l libstdc++.so*
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo

安装包含 CXXABI_1.3.11 的 libstdc++.so 包,但是能找到最新版的包 libstdc++-4.8.5-44.el7.x86_64.rpm,地址https://centos.pkgs.org/7/centos-x86_64/libstdc++-4.8.5-44.el7.x86_64.rpm.html

却不包含CXXABI_1.3.11

通过安装 Anaconda3 ,里面这个libstdc++.so高版本的包可以直接用。

[mysql]tar安装mysql报错./mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.11‘ not found(废弃)_胖胖学编程的博客-CSDN博客

centos安装Anaconda3

[root@wenzi build]# mkdir /usr/local/anaconda
[root@wenzi build]# cd /usr/local/anaconda
[root@wenzi anaconda]# curl -O https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh
[root@wenzi anaconda]# ls
Anaconda3-2022.10-Linux-x86_64.sh
[root@wenzi anaconda]# chmod +x Anaconda3-2022.10-Linux-x86_64.sh
[root@wenzi anaconda]# ./Anaconda3-2022.10-Linux-x86_64.sh

此时显示Anaconda的信息,按enter

并且会出现More,继续按Enter,出现下图输入yes

然后会提示是否修改安装路径,不修改继续回车,最终出现下图,完成安装

验证

[root@wenzi anaconda]# vim /etc/profile.d/anaconda3.sh
export PATH="/root/anaconda3/bin:$PATH"
[root@wenzi anaconda]# source /etc/profile.d/anaconda3.sh
[root@wenzi anaconda]# python3
Python 3.9.13 (main, Aug 25 2022, 23:26:10)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>> quit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
#输出 Ctrl -D 回到centos命令行
[root@wenzi anaconda]# conda -V
conda 22.9.0

查找anaconda3中的libstdc++.so相关包

[root@wenzi ~]# find / -name libstdc++.so.6
/root/anaconda3/pkgs/libstdcxx-ng-11.2.0-h1234567_1/lib/libstdc++.so.6
/root/anaconda3/lib/libstdc++.so.6
/usr/lib64/libstdc++.so.6
[root@wenzi ~]# ll /root/anaconda3/lib/libstdc*
lrwxrwxrwx 1 root root       19 Sep  6 17:23 /root/anaconda3/lib/libstdc++.so -> libstdc++.so.6.0.29
lrwxrwxrwx 1 root root       19 Sep  6 17:23 /root/anaconda3/lib/libstdc++.so.6 -> libstdc++.so.6.0.29
-rwxrwxr-x 2 root root 17981480 Jun  1  2022 /root/anaconda3/lib/libstdc++.so.6.0.29

查看有无对应 CXXABI_1.3.11 版本,有CXXABI_1.3.11

[root@wenzi ~]# strings /root/anaconda3/lib/libstdc++.so.6.0.29 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_1.3.8
CXXABI_1.3.9
CXXABI_1.3.10
CXXABI_1.3.11
CXXABI_1.3.12
CXXABI_1.3.13
CXXABI_TM_1
CXXABI_FLOAT128
CXXABI_1.3
CXXABI_1.3.11
CXXABI_1.3.2
CXXABI_1.3.6
CXXABI_FLOAT128
CXXABI_1.3.12
CXXABI_1.3.9
CXXABI_1.3.1
CXXABI_1.3.5
CXXABI_1.3.8
CXXABI_1.3.13
CXXABI_1.3.4
CXXABI_TM_1
CXXABI_1.3.7
CXXABI_1.3.10
CXXABI_1.3.3

将anaconda3的libstdc++.so.6.0.29复制到/lib64下,删除原有软链接,新建软链接

[root@wenzi ~]# cp /root/anaconda3/lib/libstdc++.so.6.0.29 /lib64/
[root@wenzi ~]# rm -f /lib64/libstdc++.so.6
[root@wenzi ~]# ln -s /lib64/libstdc++.so.6.0.29 /lib64/libstdc++.so.6
[root@wenzi ~]# ll /lib64/libstdc++.so.6*
lrwxrwxrwx  1 root root       26 Sep  6 17:49 /lib64/libstdc++.so.6 -> /lib64/libstdc++.so.6.0.29
-rwxr-xr-x. 1 root root   995840 Sep 30  2020 /lib64/libstdc++.so.6.0.19
-rwxr-xr-x  1 root root 17981480 Sep  6 17:48 /lib64/libstdc++.so.6.0.29

继续MySQL初始化,成功。最后一行末尾是默认密码

[root@wenzi ~]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
2023-09-06T10:38:09.775461Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.34-linux-glibc2.28-x86_64/bin/mysqld (mysqld 8.0.34) initializing of server in progress as process 40075
2023-09-06T10:38:09.792484Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-06T10:38:10.583537Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-09-06T10:38:12.286737Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 25zsG**(i3XL
[root@wenzi ~]# mysqld_safe --user &
[root@wenzi ~]# cp support-files/mysql.server /etc/init.d/mysql.server
#可通过/etc/init.d/mysql.server start 或 status 或 stop 控制mysql
[root@wenzi ~]# /etc/init.d/mysql.server statusSUCCESS! MySQL running (2613)
[root@wenzi ~]# mysql -uroot -p
mysql: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory

初次登录数据库时出错,缺少 libncurses.so.6

查询本机 libncurses.so.6 文件,可见/usr/lib64目录下无libncurses.so.6,anaconda3里有一个libncurses.so.6 ,将其复制到 /usr/lib64目录下

[root@wenzi ~]# find / -name libncurses.so*
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libncurses.so.6
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libncurses.so.6.3
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libncurses.so
/root/anaconda3/lib/libncurses.so
/root/anaconda3/lib/libncurses.so.6
/root/anaconda3/lib/libncurses.so.6.3
/usr/lib64/libncurses.so.5
/usr/lib64/libncurses.so.5.9
[root@wenzi ~]# cp /root/anaconda3/lib/libncurses.so.6 /usr/lib64/
[root@wenzi ~]# mysql -uroot -p
mysql: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory

出现错误,处理,道理同上;成功登录数据库

[root@wenzi ~]# find / -name libtinfo.so*
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libtinfo.so.6
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libtinfo.so.6.3
/root/anaconda3/pkgs/ncurses-6.3-h5eee18b_3/lib/libtinfo.so
/root/anaconda3/lib/libtinfo.so
/root/anaconda3/lib/libtinfo.so.6
/root/anaconda3/lib/libtinfo.so.6.3
/usr/lib64/libtinfo.so.5
/usr/lib64/libtinfo.so.5.9
[root@wenzi ~]# cp /root/anaconda3/lib/libtinfo.so.6  /usr/lib64/
[root@wenzi ~]# mysql -uroot -p'25zsG**(i3XL'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.34Copyright (c) 2000, 2023, 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 'Admin.123';
Query OK, 0 rows affected (0.01 sec)mysql> quit
Bye
[root@wenzi ~]# mysql -uroot -p'Admin.123'
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 9
Server version: 8.0.34 MySQL Community Server - GPLCopyright (c) 2000, 2023, 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.00 sec)mysql> quit
Bye

源码编译安装

MySQL :: MySQL 8.0 Reference Manual :: 2.8.7 MySQL Source-Configuration Options 官方文档

[root@wenzi ~]# ls
anaconda-ks.cfg  mysql-boost-8.0.32.tar.gz  original-ks.cfg
#准备依赖
[root@wenzi ~]# yum -y install epel-release && yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make cmake libudev-devel
[root@wenzi ~]# tar -zx -f mysql-boost-8.0.32.tar.gz -C /usr/local/
[root@wenzi ~]# ln -s /usr/local/mysql-8.0.32/ /usr/local/mysql
[root@wenzi ~]# cd /usr/local/mysql
[root@wenzi mysql]# ls
boost           components       Doxyfile-ignored   include              libchangestreams  man            mysys      router             sql         support-files  vio
client          config.h.cmake   Doxyfile.in        INSTALL              libmysql          mysql          packaging  run_doxygen.cmake  sql-common  testclients
cmake           configure.cmake  doxygen_resources  libbinlogevents      libservices       mysql-test     plugin     scripts            storage     unittest
CMakeLists.txt  Docs             extra              libbinlogstandalone  LICENSE           MYSQL_VERSION  README     share              strings     utilities
[root@wenzi mysql]# cmake . \
-DWITH_BOOST=/usr/local/bootst \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SSL=system \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1
-- Running cmake version 2.8.12.2
CMake Warning at CMakeLists.txt:82 (MESSAGE):Please use cmake3 rather than cmake on this platform-- Please install cmake3 (yum install cmake3)
CMake Error at CMakeLists.txt:112 (CMAKE_MINIMUM_REQUIRED):CMake 3.5.1 or higher is required.  You are running version 2.8.12.2-- Configuring incomplete, errors occurred!

出现报错,CMake版本太低,需要CMake 3.5.1或更高版本

下载make,地址 Index of /files

[root@wenzi ~]# curl -O https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
[root@wenzi ~]# tar -xz -f cmake-3.7.2.tar.gz -C /usr/local/
[root@wenzi ~]# cd /usr/local/cmake-3.7.2/
[root@wenzi cmake-3.7.2]# ls
Auxiliary         CMakeCPackOptions.cmake.in  CMakeLogo.gif             configure         CTestConfig.cmake     doxygen.config  Modules     Source     Utilities
bootstrap         CMakeGraphVizOptions.cmake  cmake_uninstall.cmake.in  CONTRIBUTING.rst  CTestCustom.cmake.in  Help            Packaging   Templates
CMakeCPack.cmake  CMakeLists.txt              CompileFlags.cmake        Copyright.txt     DartConfig.cmake      Licenses        README.rst  Tests
[root@wenzi cmake-3.7.2]# ./configure && make && make install
#编译安装后发现版本没变化,需要重启
[root@wenzi cmake-3.7.2]# reboot
[root@wenzi ~]# cmake --version
cmake version 3.7.2CMake suite maintained and supported by Kitware (kitware.com/cmake).

继续配置mysql

[root@wenzi mysql]# cmake . \
-DWITH_BOOST=/usr/local/mysql/boost \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SSL=system \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1
-- Running cmake version 3.7.2
-- Could NOT find Git (missing:  GIT_EXECUTABLE)
-- This is .el7. as found from 'rpm -qf /'
-- Looking for a devtoolset compiler
CMake Warning at CMakeLists.txt:392 (MESSAGE):Could not find devtoolset compiler/linker in /opt/rh/devtoolset-11CMake Warning at CMakeLists.txt:394 (MESSAGE):You need to install the required packages:yum install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutilsCMake Error at CMakeLists.txt:396 (MESSAGE):Or you can set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly.-- Configuring incomplete, errors occurred!

出现错误,缺少文件,下载相关文件;再次cmake会出现报错,根据报错提示cmake时添加-DFORCE_INSOURCE_BUILD=1 ,再次cmake

[root@wenzi mysql]# yum -y install git && yum -y install centos-release-scl && yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
[root@wenzi mysql]# rm -f CMakeCache.txt
[root@wenzi mysql]# rm -f /etc/my.cnf
[root@wenzi mysql]# cmake . \
-DWITH_BOOST=/usr/local/mysql/boost \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SSL=system \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DFORCE_INSOURCE_BUILD=1

编译;安装

[root@wenzi mysql]# make && make install

继续配置MySQL

[root@wenzi ~]# vim /etc/profile.d/mysql80.sh
export PATH=$PATH:/usr/local/mysql/bin
[root@wenzi ~]# source /etc/profile.d/mysql80.sh
[root@wenzi ~]# groupadd mysql && useradd -r -g mysql -s /bin/false mysql && cd /usr/local/mysql/
[root@wenzi mysql]# mkdir mysql-files
[root@wenzi mysql]# chown mysql:mysql mysql-files
[root@wenzi mysql]# chmod 750 mysql-files
[root@wenzi mysql]# chown -R mysql:mysql /usr/local/mysql/
[root@wenzi mysql]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
[root@wenzi mysql]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
2023-09-07T11:40:24.810283Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.32/runtime_output_directory/mysqld (mysqld 8.0.32) initializing of server in progress as process 56935
2023-09-07T11:40:24.812541Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2023-09-07T11:40:24.812546Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2023-09-07T11:40:24.817945Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-07T11:40:25.047872Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-09-07T11:40:25.611765Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Mwl_rVaxM2Lk

初始化完成,末尾是默认密码;上面出现两个警告,建议使用新的UTF8MB4替代旧的。

[root@wenzi ~]# mysqld_safe --user &
[root@wenzi ~]# cp support-files/mysql.server /etc/init.d/mysql.server
[root@wenzi ~]# chmod +x /etc/init.d/mysql.server
#需要重启,不然 /etc/init.d/mysql.server status 等命令会报错
[root@wenzi ~]# reboot
#启动mysql
[root@wenzi ~]# /etc/init.d/mysql.server start

修改密码

[root@wenzi ~]# /etc/init.d/mysql.server statusSUCCESS! MySQL running (1480)
[root@wenzi ~]# mysql -uroot -p'Mwl_rVaxM2Lk'
mysql> alter user 'root'@'localhost' identified by 'Admin.123';
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye
[root@wenzi ~]# mysql -uroot -p'Admin.123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
...

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

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

相关文章

一起学数据结构(6)——栈和队列

上篇文章中&#xff0c;对栈的概念及特点进行了解释&#xff0c;并且给出了栈实现的具体代码。本篇文章将给出队列的基本概念及特点。并给出相应的代码。 1. 队列的概念及结构&#xff1a; 在给出队列的概念之前&#xff0c;先给出上篇文章中提到的栈的概念&#xff1a;一种只…

创建开机自启的脚本

在启动许多ros节点时有多种方式&#xff0c;我推荐使用launch来启动所有的节点&#xff0c;这也是一种规范的方式。以后会慢慢向这个方向靠。 除此之外还可以通过创建的脚本来启动&#xff1a; 脚本位置不限&#xff0c;只需要&#xff1a; sudo gedit xxx.sh在里面添加相应的…

【每天一道算法题】day2-认识时间复杂度

认识时间复杂度&#xff1a; O&#xff1a;读作big O&#xff0c;在数学上指的是上限的意思 常数时间的操作 一个操作如果和样本的数据量没有关系&#xff0c;每次都是固定时间内完成的操作&#xff0c;叫做常数操作。时间复杂度为一个算法流程中&#xff0c;常数操作数量的一…

html实现邮件模版布局-flex布局table布局-demo

邮件模版布局 flex - 布局简单方便 兼容性差 table - 优点 就是兼容性好&#xff0c;其他没有优点 注&#xff1a;使用图片需要png最好&#xff0c;使用svg图google邮箱会出现不能使用的情况 效果图 flex布局 <!DOCTYPE html> <html lang"en" xmlns:th&qu…

ps怎么只改变logo的文字颜色,不改变图案颜色

1.首先把图片的psd格式拖进去 2.复制一层 3.使用框选工具选出不需要改的部分 4.选着图层--图层样式--颜色叠加--&#xff08;叠加成你需要的颜色&#xff09; 5.删除框选区域 5&#xff0c;另存为即可 原理就是框选的区域是不受保护的&#xff0c;可以进行操作&#xff0…

BGP感想

BGP 边界网关协议 属于外部或域间路由协议&#xff0c;距离矢量路由协议。 AS(自治系统)&#xff0c;在一个自治系统内运行osfp,is-is,rip,vlan等,实现AS内网络互通。 BGP做什么&#xff0c;为处于不同自治系统&#xff08;AS&#xff09;中的路由器之间进行“路由信息通信…

蓝桥杯官网填空题(三角形的面积)

题目描述 本题为填空题&#xff0c;只需要算出结果后&#xff0c;在代码中使用输出语句将所填结果输出即可。 已知三角形三个顶点在直角坐标系下的坐标分别为&#xff1a; txt (2.3, 2.5) (6.4, 3.1) (5.1, 7.2) txt 求该三角形的面积。 注意&#xff0c;要提交的是一个小…

github 创建自己的分支 并下载代码

github创建自己的分支 并下载代码 目录概述需求&#xff1a; 设计思路实现思路分析1.进入到master分支&#xff0c;git checkout master;2.master-slave的个人远程仓库3.爬虫调度器4.建立本地分支与个人远程分支之间的联系5.master 拓展实现 参考资料和推荐阅读 Survive by day…

【算法】前缀和与差分

大家好&#xff01;今天我们来学习前缀和与差分算法。 目录 1. 一维前缀和 1.1 定义 1.2 计算方法 1.3 作用 1.4 适用场景 1.5 模板题 1.6 总结 2. 二维前缀和 2.1 定义 2.2 计算方法 2.3 模板题 2.4 总结 3. 一维差分 3.1 定义 3.2 差分数组 3.3 差分标记 3…

leetcode第362场周赛

2848. 与车相交的点 核心思想&#xff1a;差分数组。统计覆盖区间&#xff0c;把nums中有的区间1&#xff0c;维护区间我们用差分数组&#xff0c;然后求出差分数组的前缀和即是我们维护的区间&#xff0c;判断区间有哪些值是大于0的即可。 2849. 判断能否在给定时间到达单元格…

nacos配置中心

2.3 Nacos配置管理 Nacos可以将配置集中管理&#xff0c;也可以在配置变更时&#xff0c;及时通知微服务&#xff0c;实现配置的热更新。 2.3.1 配置管理 ​ ​ 上图第一行的流程为常规配置文件读取流程&#xff0c;现在由于需要读取nacos配置中心内的文件&#xff0c;需要额…

创建vue3项目并引用elementui

1.创建vu3项目&#xff1a; vue3官网&#xff1a;简介 | Vue.js 执行命令 npm create vuelatest 2.终端会出现如下选项&#xff0c;不确定的直接enter键进入下一步&#xff1b; 3.然后再执行下方命令&#xff1a; cd <your-project-name> npm install4.安装依赖成功…