二进制格式安装MySQL
二进制格式安装MySQL
下载二进制格式的mysql软件包
- 下载二进制格式的 mysql 软件包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
.......
[root@localhost src]# ls
debug kernels mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
- 创建用户和组
[root@localhost ~]# groupadd -r mysql
[root@localhost ~]# useradd -M -r -s /sbin/nologin -g mysql mysql
- 解压软件至 /usr/local/
[root@localhost src]# tar zxvf mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@localhost src]# ls /usr/local/
bin etc games include lib lib64 libexec mysql-5.7.31-linux-glibc2.12-x86_64 sbin share src
#做个软连接,方便操作
[root@localhost local]# ln -s mysql-5.7.31-linux-glibc2.12-x86_64 mysql
[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root 6 Nov 5 2016 bin
drwxr-xr-x. 2 root root 6 Nov 5 2016 etc
drwxr-xr-x. 2 root root 6 Nov 5 2016 games
drwxr-xr-x. 2 root root 6 Nov 5 2016 include
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib64
drwxr-xr-x. 2 root root 6 Nov 5 2016 libexec
lrwxrwxrwx. 1 root root 35 Jan 8 13:10 mysql -> mysql-5.7.31-linux-glibc2.12-x86_64
drwxr-xr-x. 9 7161 31415 129 Jun 2 2020 mysql-5.7.31-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root 6 Nov 5 2016 sbin
drwxr-xr-x. 5 root root 49 Dec 24 13:10 share
drwxr-xr-x. 2 root root 6 Nov 5 2016 src
- 修改目录 /usr/local/mysql 的属主属组
[root@localhost local]# chown -R mysql.mysql /usr/local/mysql*
[root@localhost local]# ll mysql
lrwxrwxrwx. 1 mysql mysql 35 Jan 8 13:10 mysql -> mysql-5.7.31-linux-glibc2.12-x86_64
- 添加环境变量
[root@localhost ~]# vim /etc/profile.d/mysql.sh
[root@localhost ~]# cat /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
[root@localhost ~]# source /etc/profile.d/mysql.sh
[root@localhost ~]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
- 建立数据存放目录
[root@localhost ~]# mkdir /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data/
[root@localhost ~]# ll -d /opt/data/
drwxr-xr-x. 2 mysql mysql 6 Jan 8 13:41 /opt/data/
- 初始化数据库
[root@localhost ~]# mysqld --initialize --user=mysql --datadir=/opt/data --basedir=/usr/local/mysql
2021-01-08T05:50:23.963006Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-01-08T05:50:24.553478Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-01-08T05:50:24.657628Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-01-08T05:50:24.732822Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 67142018-5175-11eb-b9fe-000c29decd5a.
2021-01-08T05:50:24.735150Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-01-08T05:50:25.814369Z 0 [Warning] CA certificate ca.pem is self signed.
2021-01-08T05:50:26.196255Z 1 [Note] A temporary password is generated for root@localhost: CkIqTt7arh+f #注意:最后的'CkIqTt7arh+f'是登陆数据库的零时密码,这个是随机的,切记要牢记!
[root@localhost ~]# echo 'CkIqTt7arh+f' > pass #做个备份,以免忘记
- 修改配置文件(没有就创建一个)
[root@localhost ~]# cp /etc/my.cnf /etc/my.cnf.bak #先做个备份
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
datadir=/opt/data
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
port=3306
pid-file=/opt/data/mysql.pid
character-set-server=utf8
log-error=/var/log/mysqld.log
- 配置服务启动脚本
[root@localhost support-files]# pwd
/usr/local/mysql/support-files
[root@localhost support-files]# ls
magic mysqld_multi.server mysql-log-rotate mysql.server
[root@localhost support-files]# cp -a mysql.server /etc/init.d/mysqld
[root@localhost support-files]# vim /etc/init.d/mysqld
........
basedir=/usr/local/mysql #修改这两行参数
datadir=/opt/data
........
- 启动 mysql
[root@localhost ~]# service mysqld start
Starting MySQL. SUCCESS!
- 设置开机自动启动
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]# chkconfig --add mysqld #添加开机自动启动
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- 修改密码
[root@localhost ~]# mysql -uroot -p'CkIqTt7arh+f'
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 3
Server version: 5.7.31
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
二进制格式安装MySQL的更多相关文章
- centos6下通用二进制格式安装MySQL过程
1.首先确保主机的MySQL没有运行 #ss -tnl //查看有没有80端口 或者 #service mysqld stop 2.添加mysql用户和组 #id mysql //首先查看mysq ...
- 二进制包安装MySQL数据库
1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) [root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径 [ ...
- MySQL使用通用二进制格式安装
CentOS7安装MySQL的方法之通用二进制格式
- 二进制包安装Mysql
(1).准备工作 前往mysql官网下载二进制安装包,https://dev.mysql.com/downloads/mysql/5.7.html#downloads(注意:选择操作系统时选Linux ...
- 二进制包安装MYSQL——
yum install libaio -y #安装mysql依赖包tar zxf mysql-5.5.59-linux-glibc2.12-x86_64.tar.gz mv mysql-5.5.59- ...
- 二进制方式安装mysql
下载官方打包好的rpm的集合 https://downloads.mysql.com/archives/get/file/mysql-5.7.20-1.el7.x86_64.rpm-bundle.ta ...
- Linux 二进制包安装MySQL的一些问题
第一步:安装相关的依赖yum install perl-Data-Dumper 第二步:初始化mysql数据库的内部信息./scripts/mysql_install_db --basedir=/us ...
- mysql5.6.13通用二进制格式安装并使用amoeba实现对mysql5.6数据库读写分离
proxy 192.168.8.39 master 192.168.8.40 slave 192.168.8.20 一.安装mysql-5.6.13服务器 安装包: mysql-5.6.13-linu ...
- CentOS 7使用通过二进制包安装MySQL 5.7.18
安装依赖 yum install -y libaio 下载 wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux- ...
随机推荐
- RabbitMQ 入门 (Go) - 7. 数据持久化(下)【完】
数据库 我使用的是 PostgreSQL. 使用的驱动是 github.com/lib/pq 这个网址 https://pkg.go.dev/github.com/lib/pq 是官方文档. 创建数据 ...
- 201871010203-陈鹏昱 实验三 结对项目—《D{0-1}KP 实例数据集算法实验平台》项目报告
项目 内容 课程班级博客链接 班级博客 这个作业要求链接 作业要求 我的课程学习目标 学习软件工程的理论和知识,掌握软件开发流程,增强实践能力 这个作业在哪些方面帮助我实现学习目标 体验软件项目开发中 ...
- 201871030112-贾傲羊 实验三 结对项目—《D{0-1}KP 实例数据集算法实验平台》项目报告
项目 内容 课程班级博客链接 课程班级博客链接 这个作业要求链接 作业要求链接 我的课程学习目标 学习PSP流程并运用于结对项目:学习GitHub代码的管理;学习结对编程的流程与内容 这个作业在哪些方 ...
- php添加excel更新数据表数据
公司有个需求,是用excel更新数据的,把错误的行列放到一个数组返回出来,正常的数据则插入,且返回数量 1.先需要引入phpspreadsheet,这里使用composer 安装 composer r ...
- [开源]制作docker镜像不依赖linux和Docker环境
背景 最近群友们经常反馈docker镜像制作起来有点麻烦,我开源的antdeploy工具虽然可以制作镜像但是必须有一个提前:有一台安装好docker的linux服务器.因为大家开发环境基本上都是win ...
- 浅入Kubernetes(7):应用部署实例,Deployment、Service、ReplicaSet
目录 Deployment 创建 Deployment kubectl apply/create 网络端口映射和更新 Deployment ReplicaSet 在本文之前,你需要阅读: 尝试 kub ...
- @Scheduled注解
1 概述 @Scheduled注解是spring boot提供的用于定时任务控制的注解,主要用于控制任务在某个指定时间执行,或者每隔一段时间执行.注意需要配合@EnableScheduling使用,配 ...
- Kubernetes删除一直处于Terminating状态的namespace
问题现象: 删除namespace,一直处于Terminating,并且用--force --grace-period=0 也删除不了 develop Terminating 4d9h Error f ...
- Day05_25_Super关键字
Super关键字 Super关键字的所用 Super关键字的用法有三种: 在子类的成员方法中,访问父类的成员变量. 在子类的成员方法中,访问父类的成员方法. 在子类的构造方法中,访问父类的构造方法. ...
- Ribbon、Feign和OpenFeign的区别
Spring Cloud 微服务架构学习记录与示例 Ribbon Ribbon 是 Netflix开源的基于HTTP和TCP等协议负载均衡组件 Ribbon 可以用来做客户端负载均衡,调用注册中心的服 ...