linux mysql 安装

建用户组和用户

groupadd mysql  
useradd -r -g mysql mysql

下载

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
cp xxx.tar.gz /usr/local/mysql
./usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
vi /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8
# 取消密码验证
skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# skip-grant-tables
[mysqld_safe]
log-error=/usr/local/mysql/logs/mysqld.log
pid-file=/usr/local/mysql/mysqld.pid

启动mysql

sh /usr/local/mysql/support-files/mysql.server start

指定配置文件
./mysqld_safe --defaults-file=/usr/local/mysql/my.cnf > mysqld.log 2>&1 &

将mysql加入到服务中

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

开机启动

chkconfig mysql on

分析binlog 日志

mysqlbinlog --no-defaults --database=mudskipper  --base64-output=decode-rows -v --start-datetime='2021-07-01 17:00:00' --stop-datetime='2021-07-01 17:30:00'  /root/mysql-bin.000398 >/root/xxx.sql

你可能感兴趣的:(linux mysql 安装)