赞
踩
- #查看本机版本
- [root@localhost ~]# cat /etc/redhat-release
- Red Hat Enterprise Linux release 9.1 (Plow)
-
- #在mysql官网上找到本机需要版本的域名然后用rpm安装下载下来
- [root@localhost ~]# rpm -ivh http://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
- 获取http://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
- 警告:/var/tmp/rpm-tmp.v8CBoF: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
- Verifying... ################################# [100%]
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:mysql80-community-release-el9-1 ################################# [100%]
-
- #之前用的https://报以下错误,查看一下是网址的问题,改用http://域名
- 获取https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
- curl: (28) Operation timed out after 300710 milliseconds with 0 out of 0 bytes received
- 错误:跳过 https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm - 传输失败
-
- #安装mysql服务器
- [root@localhost ~]# dnf install mysql-server -y
- 正在更新 Subscription Management 软件仓库。
- 无法读取客户身份
-
- 本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
-
- 依赖关系解决。
- ========================================================================================================================
- 软件包 架构 版本 仓库 大小
- ========================================================================================================================
- 安装:
- mysql-community-server x86_64 8.0.32-1.el9 mysql80-community 49 M
- 安装依赖关系:
- mysql-community-client x86_64 8.0.32-1.el9 mysql80-community 3.9 M
- mysql-community-client-plugins x86_64 8.0.32-1.el9 mysql80-community 1.4 M
- mysql-community-common x86_64 8.0.32-1.el9 mysql80-community 544 k
- mysql-community-icu-data-files x86_64 8.0.32-1.el9 mysql80-community 2.2 M
- mysql-community-libs x86_64 8.0.32-1.el9 mysql80-community 1.5 M
-
- 事务概要
- ========================================================================================================================
- 安装 6 软件包
-
- 总下载:59 M
- 安装大小:335 M
- 下载软件包:
- (1/6): mysql-community-common-8.0.32-1.el9.x86_64.rpm 368 kB/s | 544 kB 00:01
- (2/6): mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm 844 kB/s | 1.4 MB 00:01
- (3/6): mysql-community-client-8.0.32-1.el9.x86_64.rpm 1.9 MB/s | 3.9 MB 00:02
- (4/6): mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm 2.9 MB/s | 2.2 MB 00:00
- (5/6): mysql-community-libs-8.0.32-1.el9.x86_64.rpm 1.6 MB/s | 1.5 MB 00:00
- (6/6): mysql-community-server-8.0.32-1.el9.x86_64.rpm 7.4 MB/s | 49 MB 00:06
- ------------------------------------------------------------------------------------------------------------------------
- 总计 6.7 MB/s | 59 MB 00:08
- 运行事务检查
- 事务检查成功。
- 运行事务测试
- 事务测试成功。
- 运行事务
- 准备中 : 1/1
- 安装 : mysql-community-common-8.0.32-1.el9.x86_64 1/6
- 安装 : mysql-community-client-plugins-8.0.32-1.el9.x86_64 2/6
- 安装 : mysql-community-libs-8.0.32-1.el9.x86_64 3/6
- 运行脚本: mysql-community-libs-8.0.32-1.el9.x86_64 3/6
- 安装 : mysql-community-client-8.0.32-1.el9.x86_64 4/6
- 安装 : mysql-community-icu-data-files-8.0.32-1.el9.x86_64 5/6
- 运行脚本: mysql-community-server-8.0.32-1.el9.x86_64 6/6
- 安装 : mysql-community-server-8.0.32-1.el9.x86_64 6/6
- 运行脚本: mysql-community-server-8.0.32-1.el9.x86_64 6/6
- 验证 : mysql-community-client-8.0.32-1.el9.x86_64 1/6
- 验证 : mysql-community-client-plugins-8.0.32-1.el9.x86_64 2/6
- 验证 : mysql-community-common-8.0.32-1.el9.x86_64 3/6
- 验证 : mysql-community-icu-data-files-8.0.32-1.el9.x86_64 4/6
- 验证 : mysql-community-libs-8.0.32-1.el9.x86_64 5/6
- 验证 : mysql-community-server-8.0.32-1.el9.x86_64 6/6
- 已更新安装的产品。
-
- 已安装:
- mysql-community-client-8.0.32-1.el9.x86_64 mysql-community-client-plugins-8.0.32-1.el9.x86_64
- mysql-community-common-8.0.32-1.el9.x86_64 mysql-community-icu-data-files-8.0.32-1.el9.x86_64
- mysql-community-libs-8.0.32-1.el9.x86_64 mysql-community-server-8.0.32-1.el9.x86_64
-
- 完毕!
-
- #查看所装的包
- [root@localhost ~]# rpm -qa | grep mysql
- mysql80-community-release-el9-1.noarch
- mysql-community-common-8.0.32-1.el9.x86_64
- mysql-community-client-plugins-8.0.32-1.el9.x86_64
- mysql-community-libs-8.0.32-1.el9.x86_64
- mysql-community-client-8.0.32-1.el9.x86_64
- mysql-community-icu-data-files-8.0.32-1.el9.x86_64
- mysql-community-server-8.0.32-1.el9.x86_64
-
- #启动mysql
- [root@localhost ~]# systemctl start mysqld
- [root@localhost ~]# systemctl status mysqld
- ● mysqld.service - MySQL Server
- Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pre>
- Active: active (running) since Sun 2023-02-12 18:14:13 CST; 30min ago
- Docs: man:mysqld(8)
- http://dev.mysql.com/doc/refman/en/using-systemd.html
- Process: 1053 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=>
- Main PID: 1545 (mysqld)
- Status: "Server is operational"
- Tasks: 39 (limit: 10756)
- Memory: 248.9M
- CPU: 11.780s
- CGroup: /system.slice/mysqld.service
- └─1545 /usr/sbin/mysqld
-
- 2月 12 18:14:05 localhost systemd[1]: Starting MySQL Server...
- 2月 12 18:14:13 localhost.localdomain systemd[1]: Started MySQL Server.
-
- #查看数据库密码,在/var/log/mysqld.log,用grep筛选出来
- [root@localhost ~]# grep password /var/log/mysqld.log
- 2023-02-10T01:19:30.736981Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Z+wHe6B4rfr)
-
- #登录数据库
- [root@localhost ~]# mysql -uroot -pZ+wHe6B4rfr
-
- #登录之后必须先修改用户密码,默认密码策略要求密码至少包含一个大写字母、一个小写字母、一位数字和一个特殊字符,并且密码总长度至少为8个字符。
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
- Query OK, 0 rows affected (0.00 sec)
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | sys |
- +--------------------+
- 4 rows in set (0.00 sec)
-
- 仓库安装完毕,可以尽情的在mysql中玩耍啦
-
- #想卸载数据库也不是不可以,输入以下指令就可以啦
- [root@localhost ~]# dnf remove mysql-server -y
- [root@localhost ~]# rpm -qa | grep mysql
- [root@localhost ~]# dnf remove mysql80-community-release -y
- [root@localhost ~]# rm -rf /var/lib/mysql/ /var/log/mysqld.log
- #你可以尝试其他方式的安装咯
- #为了保证本地安装的成功,先新建一个目录
- [root@localhost ~]# mkdir mysql
-
- #进入mysql目录中,把需要的mysql包搞下来
- [root@localhost ~]# cd mysql/
- [root@localhost mysql]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
- --2023-02-12 18:59:42-- https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
- 正在解析主机 cdn.mysql.com (cdn.mysql.com)... 223.119.242.56
- 正在连接 cdn.mysql.com (cdn.mysql.com)|223.119.242.56|:443... 已连接。
- 已发出 HTTP 请求,正在等待回应... 200 OK
- 长度:849367040 (810M) [application/x-tar]
- 正在保存至: “mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar”
-
- mysql-8.0.32-1.el9.x86_64.rpm 100%[=================================================>] 810.02M 11.2MB/s 用时 75s
-
- 2023-02-12 19:01:22 (10.8 MB/s) - 已保存 “mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar” [849367040/849367040])
-
- #解压刚才搞下来的包
- [root@localhost mysql]# tar xvf mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
- mysql-community-client-8.0.32-1.el9.x86_64.rpm
- mysql-community-client-debuginfo-8.0.32-1.el9.x86_64.rpm
- mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm
- mysql-community-client-plugins-debuginfo-8.0.32-1.el9.x86_64.rpm
- mysql-community-common-8.0.32-1.el9.x86_64.rpm
- mysql-community-debuginfo-8.0.32-1.el9.x86_64.rpm
- mysql-community-debugsource-8.0.32-1.el9.x86_64.rpm
- 实际下面很多,俺只截取了一点
-
- #安装mysql-community-server所产生的依赖包
- [root@localhost mysql]# rpm -ivh mysql-community-server-8.0.32-1.el9.x86_64.rpm mysql-community-client-8.0.32-1.el9.x86_64.rpm mysql-community-common-8.0.32-1.el9.x86_64.rpm mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm mysql-community-libs-8.0.32-1.el9.x86_64.rpm
- Verifying... ################################# [100%]
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:mysql-community-client-plugins-8.################################# [ 17%]
- 2:mysql-community-common-8.0.32-1.e################################# [ 33%]
- 3:mysql-community-libs-8.0.32-1.el9################################# [ 50%]
- 4:mysql-community-client-8.0.32-1.e################################# [ 67%]
- 5:mysql-community-icu-data-files-8.################################# [ 83%]
- 6:mysql-community-server-8.0.32-1.e################################# [100%]
-
- #启动mysql服务
- [root@localhost mysql]# systemctl start mysqld
- [root@localhost mysql]# systemctl status mysqld
- ● mysqld.service - MySQL Server
- Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pre>
- Active: active (running) since Sun 2023-02-12 18:14:13 CST; 50min ago
- Docs: man:mysqld(8)
- http://dev.mysql.com/doc/refman/en/using-systemd.html
- Process: 1053 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=>
- Main PID: 1545 (mysqld)
- Status: "Server is operational"
- Tasks: 39 (limit: 10756)
- Memory: 212.2M
- CPU: 17.560s
- CGroup: /system.slice/mysqld.service
- └─1545 /usr/sbin/mysqld
-
- 2月 12 18:14:05 localhost systemd[1]: Starting MySQL Server...
- 2月 12 18:14:13 localhost.localdomain systemd[1]: Started MySQL Server.
-
- #查看数据库密码,在/var/log/mysqld.log,用grep筛选出来
- [root@localhost ~]# grep password /var/log/mysqld.log
- 2023-02-10T01:19:30.736981Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Z+wHe6B4rfr)
-
- #登录数据库
- [root@localhost ~]# mysql -uroot -pZ+wHe6B4rfr
-
- #登录之后必须先修改用户密码,默认密码策略要求密码至少包含一个大写字母、一个小写字母、一位数字和一个特殊字符,并且密码总长度至少为8个字符。
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
- Query OK, 0 rows affected (0.00 sec)
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | sys |
- +--------------------+
- 4 rows in set (0.00 sec)
-
- 本地安装就好啦,当然卸载也很简单
- [root@localhost mysql]# rpm -qa | grep mysql
- mysql-community-common-8.0.32-1.el9.x86_64
- mysql-community-client-plugins-8.0.32-1.el9.x86_64
- mysql-community-libs-8.0.32-1.el9.x86_64
- mysql-community-client-8.0.32-1.el9.x86_64
- mysql-community-icu-data-files-8.0.32-1.el9.x86_64
- mysql-community-server-8.0.32-1.el9.x86_64
- [root@localhost mysql]# rpm -evh mysql-community-common mysql-community-client-pplugins mysql-community-libs mysql-community-client mysql-community-icu-data-files mysql-community-server
- [root@localhost ~]# rm -rf /var/lib/mysql/ /var/log/mysqld.log
- 这就可以咯,让我们继续下一种安装方式
- #容器安装的一些依赖包
- [root@localhost ~]# dnf install -y yum-utils device-mapper-persistent-data lvm2
- 正在更新 Subscription Management 软件仓库。
- 无法读取客户身份
-
- 本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
-
- 上次元数据过期检查:1:47:42 前,执行于 Sat 11 Feb 2023 15:08:09 CST。
- 软件包 device-mapper-persistent-data-0.9.0-13.el9.x86_64 已安装。
- 软件包 lvm2-9:2.03.16-3.el9.x86_64 已安装。
- 依赖关系解决。
- ========================================================================================================================
- 软件包 架构 版本 仓库 大小
- ========================================================================================================================
- 安装:
- yum-utils noarch 4.1.0-3.el9 base 45 k
-
- 事务概要
- ========================================================================================================================
- 安装 1 软件包
-
- 总计:45 k
- 安装大小:23 k
- 下载软件包:
- 运行事务检查
- 事务检查成功。
- 运行事务测试
- 事务测试成功。
- 运行事务
- 准备中 : 1/1
- 安装 : yum-utils-4.1.0-3.el9.noarch 1/1
- 运行脚本: yum-utils-4.1.0-3.el9.noarch 1/1
- 验证 : yum-utils-4.1.0-3.el9.noarch 1/1
- 已更新安装的产品。
-
- 已安装:
- yum-utils-4.1.0-3.el9.noarch
-
- 完毕!
-
- #容器仓库添加阿里云的
- [root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 正在更新 Subscription Management 软件仓库。
- 无法读取客户身份
-
- 本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
-
- 添加仓库自:https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-
- #下载docker时修改网站为阿里云网站
- [root@localhost ~]# sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
-
- #安装docker-ce
- [root@localhost ~]# dnf install docker-ce --allowerasing -y
-
- #启动容器
- [root@localhost ~]# systemctl start docker
- [root@localhost ~]# systemctl status docker
- ● docker.service - Docker Application Container Engine
- Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
- Active: active (running) since Sat 2023-02-12 19:21:32 CST; 7s ago
- TriggeredBy: ● docker.socket
- Docs: https://docs.docker.com
- Main PID: 9559 (dockerd)
- Tasks: 7
- Memory: 24.5M
- CPU: 173ms
- CGroup: /system.slice/docker.service
- └─9559 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
-
- Feb 11 17:12:31 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:31.723160244+08:00" level=info msg="[core] [Chann>
- Feb 11 17:12:31 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:31.763898158+08:00" level=info msg="Loading conta>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.443463649+08:00" level=info msg="Default bridg>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.626962098+08:00" level=info msg="Firewalld: in>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.854013030+08:00" level=info msg="Loading conta>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.887442173+08:00" level=info msg="Docker daemon>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.888149989+08:00" level=info msg="Daemon has co>
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-12T17:12:32.918032658+08:00" level=info msg="[core] [Serve>
- Feb 11 17:12:32 192.168.130.128 systemd[1]: Started Docker Application Container Engine.
- Feb 11 17:12:32 192.168.130.128 dockerd[9559]: time="2023-02-11T17:12:32.935974546+08:00" level=info msg="API listen on
-
- #测试容器
- [root@localhost ~]# docker version
- Client: Docker Engine - Community
- Version: 23.0.1
- API version: 1.42
- Go version: go1.19.5
- Git commit: a5ee5b1
- [root@localhost ~]# docker run hello-world
- Unable to find image 'hello-world:latest' locally
- latest: Pulling from library/hello-world
- 2db29710123e: Pull complete
- Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe
- Status: Downloaded newer image for hello-world:latest
-
- #运行mysqltest容器
- [root@localhost ~]# docker run --name mysqltest -e MYSQL_ROOT_PASSWORD=123456 -d mysql
- Unable to find image 'mysql:latest' locally
- latest: Pulling from library/mysql
- 197c1adcd755: Pull complete
- 45f2e353f7d2: Pull complete
-
- #先进容器再进入数据库
- [root@192 ~]# docker exec -it mysqltest /bin/bash
- bash-4.4# 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.32 MySQL Community Server - GPL
-
- Copyright (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)
- 容器安装就阔以咯
源码安装前需关机把虚拟机的运行内存设置到4G以上
- #添加用户和组
- [root@localhost ~]# groupadd mysql
- [root@localhost ~]# useradd -r -g mysql -s /bin/false mysql
-
- #下载源码安装包
- [root@localhost ~]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
- --2023-02-12 19:36:31-- https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
- 正在解析主机 cdn.mysql.com (cdn.mysql.com)... 2.19.84.217
- 正在连接 cdn.mysql.com (cdn.mysql.com)|2.19.84.217|:443... 已连接。
- 已发出 HTTP 请求,正在等待回应... 200 OK
- 长度:436207624 (416M) [application/x-tar-gz]
- 正在保存至: “mysql-boost-8.0.32.tar.gz.1”
-
- mysql-boost-8.0.32.tar.gz.1 100%[=================================================>] 416.00M 7.60MB/s 用时 62s
-
- 2023-02-12 19:37:11 (6.76 MB/s) - 已保存 “mysql-boost-8.0.32.tar.gz.1” [436207624/436207624])
-
- #解压源码安装包
- [root@localhost ~]# tar xvf mysql-boost-8.0.32.tar.gz
- mysql-8.0.32/
- mysql-8.0.32/.clang-format
- mysql-8.0.32/.gitconfig
- mysql-8.0.32/CMakeLists.txt
- mysql-8.0.32/Docs/
-
- #安装编译器需要的工具
- [root@localhost ~]# yum install gcc gcc-c++ cmake -y
- 正在更新 Subscription Management 软件仓库。
- 无法读取客户身份
-
- 本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
-
- 上次元数据过期检查:0:45:37 前,执行于 Sat 12 Feb 2023 19:12:40 CST。
- 依赖关系解决。
- ========================================================================================================================
- 软件包 架构 版本 仓库 大小
- ========================================================================================================================
- 安装:
- cmake x86_64 3.20.2-7.el9 app 6.7 M
- gcc x86_64 11.3.1-2.1.el9 app 32 M
- gcc-c++ x86_64 11.3.1-2.1.el9
-
- #安装编译时需要的库
- [root@localhost ~]# yum install cmake gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils openssl-devel ncurses-devel libtirpc rpcgen git -y
-
- [root@localhost ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
- 获取https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
- 警告:/var/tmp/rpm-tmp.5Pu21j: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
- Verifying... ################################# [100%]
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:libtirpc-devel-1.3.3-0.el9 ################################# [100%]
-
- #进入mysql-8.0.32/目录,创建bld目录,然后起服务
- [root@localhost ~]# cd mysql-8.0.32/
- [root@localhost mysql-8.0.32]# mkdir bld
- [root@localhost mysql-8.0.32]# cd bld
- [root@localhost bld]# cmake .. -DWITH_BOOST=../boost/boost_1_77_0/
- -- Running cmake version 3.20.2
- -- Found Git: /usr/bin/git (found version "2.31.1")
- -- This is .el9. as found from 'rpm -qf /'
-
- #编译(此过程大概需要2-3小时,根据电脑性能不同,时间不同,慢慢等咯)
- [root@localhost bld]# make
- [ 0%] Built target abi_check
- [ 0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/adler32.c.o
- [ 0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/compress.c.o
- [ 0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/crc32.c.o
-
- [root@localhost bld]# make install
- [ 0%] Built target abi_check
- Consolidate compiler generated dependencies of target zlib_objlib
- [ 1%] Built target zlib_objlib
-
- # 创建目录并修改所属者和所属组并修改权限
- [root@localhost bld]# cd /usr/local/mysql
- [root@localhost mysql]# mkdir mysql-files
- [root@localhost mysql]# chown mysql:mysql mysql-files
- [root@localhost mysql]# chmod 750 mysql-files
-
- #初始化数据库
- [root@localhost mysql]# ./bin/mysqld --initialize --user=mysql
- 2023-02-12T19:54:21.356408Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) initializing of server in progress as process 46939
- 2023-02-12T19:54:21.378025Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
- 2023-02-12T19:54:22.324104Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
- 2023-02-12T19:54:23.609467Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >k-Pqm=L6oXt
-
- #开启支持ssl加密
- [root@localhost mysql]# ./bin/mysql_ssl_rsa_setup
-
- #后台启动mysql进程
- [root@localhost mysql]# ./bin/mysqld_safe --user=mysql &
-
- #进入数据库(临时密码在初始化时屏幕上有输出)
- [root@192 mysql]# ./bin/mysql -uroot -p'Z+wHe6B4rfr'
-
- #登录之后必须先修改用户密码,默认密码策略要求密码至少包含一个大写字母、一个小写字母、一位数字和一个特殊字符,并且密码总长度至少为8个字符。
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
- Query OK, 0 rows affected (0.00 sec)
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | sys |
- +--------------------+
- 4 rows in set (0.00 sec)
- 以上就是源码安装,学废了吗
停下休息的时候,不要忘记别人在奔跑。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。