当前位置:网站首页>Linux安装MySQL脚本
Linux安装MySQL脚本
2022-06-10 01:12:00 【bug智造】
centos系统非root用户安装mysql脚本文件
#!/bin/sh
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
##解压
tar -xvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz -C ~/
cd ~
mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql
#
###建好配置文件与mysql数据存储目录
mkdir /home/$USER/mysql/data
mkdir /home/$USER/mysql/conf
#echo $USER
cat > /home/$USER/mysql/conf/my.cnf << EOF
#!/bin/sh
[client]
default-character-set=utf8mb4
socket = /home/$USER/mysql/data/mysql.sock
[mysql]
port = 3306
socket = /home/$USER/mysql/data/mysql.sock
default-character-set=utf8mb4
[mysqld]
explicit_defaults_for_timestamp=true
port = 3306
default_storage_engine=InnoDB
basedir = /home/$USER/mysql
datadir = /home/$USER/mysql/data
socket = /home/$USER/mysql/data/mysql.sock
character-set-client-handshake = FALSE
character-set-server=utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
max_connections = 2000
max_allowed_packet = 128M
innodb_file_per_table = 1
tmp_table_size = 134217728
max_heap_table_size = 134217728
lower_case_table_names=1
log-bin = mysql-bin
max_binlog_size = 1024M
expire_logs_days = 1
log_slave_updates = 1
server-id = 1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
skip-grant-tables
EOF
cat >> ~/.bashrc << EOF
export PATH=/home/$USER/mysql/bin:\$PATH
EOF
source ~/.bashrc
##将sock文件链接到/tmp目录,默认mysql是读/tmp下的
ln -s /home/$USER/mysql/data/mysql.sock /tmp/mysql.sock
sh mysql_start
#初始化数据库
mysqld --defaults-file=/home/$USER/mysql/conf/my.cnf --user=$USER --initialize
#启动数据库
/home/$USER/mysql/bin/mysqld_safe --defaults-file=/home/$USER/mysql/conf/my.cnf --user=$USER &
#mysqladmin -u root -p password "root"
#mysql -uroot -proot
#更改密码为root
#set password for [email protected] = password("root")
边栏推荐
- 面试必刷算法TOP101之字符串篇 TOP30
- window. Open (URL) opens the download link for many times and is blocked by the browser. JS realizes circular access to multiple download links
- 分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
- d内存中映射指令并执行
- Esri整合LightBox数据以扩展加拿大境内的地理编码
- Disorder of flinksql
- 写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
- Locust: a powerful tool for microservice performance testing
- 腾讯Libco协程开源库 源码分析(一)---- 下载Libco 编译安装 尝试运行示例代码
- 漫谈测试覆盖率
猜你喜欢

JVM records a CPU surge

More powerful reduce than you think and thinking about code tapping

The project was successful, and the project manager was the greatest contributor?

騰訊Libco協程開源庫 源碼分析(一)---- 下載Libco 編譯安裝 嘗試運行示例代碼

How can win11 directly return to the desktop?

CocosCreator旧活新整-合成大粽子

Source code analysis of Tencent libco collaboration open source library (I) -- download libco compilation and installation and try to run the sample code

【Proteus仿真】51单片机+LCD1602+外置存储器计算器

图片批量下载 +图片马赛克:多张图片组成端午安康!

What if win11 returns win10 without a return option?
随机推荐
[games101] Assignment 1 -- MVP (model, view, projection) transformation
【LeetCode】105. 从前序与中序遍历序列构造二叉树
Associative array & regular expression
Never far away, five programming languages that may be doomed to decline
Various utilization forms of map tile data and browsing display of tile data
Web3对元宇宙的数据主权至关重要
加密机与数据库加密产品的区别?
The writing speed is increased by tens of times. The application of tdengine in tostar intelligent factory solution
Regular expression does not contain a string
Application of fire door monitoring system in a residential project
Locust: a powerful tool for microservice performance testing
洛谷P1029 最大公约数和最小公倍数问题 题解
Way home
Application of discrete time integration in Simulink simulation
ThingsBoard教程(十九):规则节点概览介绍
Shell exec and i/o redirection
Alleviate and repair Android studio Caton, kotlin code prompt is slow
TCP 连接中的keep-alive
图片批量下载 +图片马赛克:多张图片组成端午安康!
生产线往越南转移未必是好选择,三星手机已受累并计划回归韩国