当前位置:网站首页>Mysql5.7 二进制 部署
Mysql5.7 二进制 部署
2022-08-05 05:11:00 【趴着的猫】
一 下载
下载路径:MySQL :: Download MySQL Community Server (Archived Versions)
环境:centos7
二 部署
1、上传并解压
[[email protected] opt]# tar -zxvf mysql-5.7.37-el7-x86_64.tar.gz
[[email protected] opt]# ls
mysql-5.7.37-el7-x86_64 mysql-5.7.37-el7-x86_64.tar.gz2、创建用户和data目录
[[email protected] opt]# useradd -s /bin/nologin mysql
[[email protected] opt]# mkdir mysql-5.7.37-el7-x86_64/data
[[email protected] opt]# chown -R mysql:mysql /opt/mysql-5.7.37-el7-x86_64
[[email protected] opt]# mv mysql-5.7.37-el7-x86_64 mysql #重命名3 初始化
[[email protected] opt]# cd /opt/mysql/
[[email protected] mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/data/mysql/ --datadir=/data/mysql/data --log-error=/opt/mysql/error.log --pid-file=/opt/mysql/data/mysql.pid
[[email protected] mysql]# cat error.log #查看初始化密码 最后一行 [email protected]:后面
2022-08-04T07:07:22.333620Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-04T07:07:23.530589Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-08-04T07:07:23.561088Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-08-04T07:07:23.626307Z 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: 16da16ed-13c4-11ed-8751-000c2947a17b.
2022-08-04T07:07:23.627382Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-08-04T07:07:24.461211Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-08-04T07:07:24.461235Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-08-04T07:07:24.462478Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-04T07:07:24.948371Z 1 [Note] A temporary password is generated for [email protected]: &L:o<uBr+5>3
初始化参数说明:
--user=mysql: 指定用户
--basedir= :指定mysql 目录
--datadir=:指定mysql 的data 数据目录
--log-error= :指定mysql log 日志文件路径
--pid-file=:指定pid 文件路径
4 设置my.cnf
[[email protected] mysql]# vim /etc/my.cnf
[mysql]
default-character-set=utf8
socket=/opt/mysql/mysql.sock
[mysqld]
basedir=/opt/mysql
datadir=/opt/mysql/data
socket=/opt/mysql/mysql.sock
port=3306
character-set-server=utf8
skip-name-resolve
default-time-zone='+08:00'
default-storage-engine=INNODB
max_connections=500
max_heap_table_size=64M
sort_buffer_size=64M
join_buffer_size=32M
query_cache_size=128M
innodb_buffer_pool_size=8G
lower_case_table_names=1
# Disabling symbolic-links is recommended to prevent assorted security risks
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/opt/mysql/error.log
pid-file=/opt/mysql/data/mysql.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
重要参数说明:
lower_case_table_names=1 :windows 默认是1,linux 默认是0 ,0:表名字是存储给定的大小并且是区分大小写的,1:表名字存储在磁盘是小写的,但是比较的时候不区分大小写,存储的时候是按照给定的大小写存储的,比较的时候是按照小写的方式比较。
default-character-set=utf8:设置字符集,mysql默认字符集为latin,这里设置UTF8
default-time-zone='+08:00':MySQL默认的时区是UTC时区,比北京时间晚8个小时,设置MySQL默认时区为东八区。
max_connections=500:最大连接数。
5 启动并设置开机自启
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
vim /etc/init.d/mysqld
basedir=/opt/mysql
datadir=/opt/mysql/data
mysqld_pid_file_path=/opt/mysql/data/mysql.pid #设置这3个参数即可chkconfig --add mysqld
6 初始化后修改数据库root 密码
[[email protected] mysql]# vim /etc/profile #跳到文件最后加
export MYSQL_HOME=/opt/mysql
export PATH=$MYSQL_HOME/bin:$PATH
[[email protected] mysql]# source /etc/profile mysql -u root -p #输入刚刚查看日志的密码登录
ALTER USER 'root'@'localhost' identified by 'newpassword';
边栏推荐
- 1068找到更多的硬币
- MySQL中控制导出文件后变为了\N有什么解决方案吗?
- 雷克萨斯lm的安全性到底体现在哪里?一起来看看吧
- u-boot debugging and positioning means
- 2023 International Conference on Information and Communication Engineering (JCICE 2023)
- RL强化学习总结(一)
- Day019 方法重写与相关类的介绍
- [cesium] element highlighting
- C language - vernacular to understand the original code, inverse code and complement code
- number_gets the specified number of decimals
猜你喜欢

二叉树基本性质+oj题解析
![[cesium] 3D Tileset model is loaded and associated with the model tree](/img/03/50b7394f33118c9ca1fbf31b737b1a.png)
[cesium] 3D Tileset model is loaded and associated with the model tree

MySQL基础(一)---基础认知及操作

Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!

ESP32 485光照度

jvm three heap and stack

Homework 8.4 Interprocess Communication Pipes and Signals

【cesium】3D Tileset 模型加载并与模型树关联

雷克萨斯lm的安全性到底体现在哪里?一起来看看吧
How to identify false evidence and evidence?
随机推荐
Flutter learning 5-integration-packaging-publish
upload上传图片到腾讯云,如何上传图片
u-boot debugging and positioning means
多线程查询结果,添加List集合
开发一套高容错分布式系统
【解码工具】Bitcoin的一些在线工具
Flutter真机运行及模拟器运行
Reverse theory knowledge 4
In the hot summer, teach you to use Xiaomi smart home accessories + Raspberry Pi 4 to connect to Apple HomeKit
Redis - 13. Development Specifications
Structured Light 3D Reconstruction (2) Line Structured Light 3D Reconstruction
[cesium] 3D Tileset model is loaded and associated with the model tree
Talk about 20 common problems in data governance
Use IDEA to connect to TDengine server
Is the NPDP certificate high in gold content?Compared to PMP?
[informix] Resolving startup errors and solutions
RL强化学习总结(一)
for..in和for..of的区别
Excel画图
8.04 Day35-----MVC three-tier architecture