1. 安装mysql
1.1.解压安装mysql
#tar zxvf mysql-5.7.32-linux-glibc2.12-x86_64.tar.gz
#mv mysql-5.7.32-linux-glibc2.12-x86_64 /forp/mysql-5.7.32
#chown -R forp1:root /forp/mysql-5.7.32
1.2.创建相关目录
下面所有操作切换至普通用户forp1下执行
su – forp1
$ mkdir /forp/mysql-5.7.32/data
$ mkdir /forp/mysql-5.7.32/conf
$ mkdir /forp/mysql-5.7.32/logs
$ mkdir /forp/mysql-5.7.32/temp
1.3.创建配置文件
cat /forp/mysql-5.7.32/conf/mysql.conf
[mysqld]
port=3306
socket=/forp/mysql-5.7.32/temp/mysql.sock
user=forp1
datadir=/forp/mysql-5.7.32/data
default-time_zone='+8:00'
log-output=FILE
log-error=/forp/mysql-5.7.32/logs/error.log
long_query_time=8
slow_query_log=1
slow_query_log_file =/forp/mysql-5.7.32/logs/slow.log
general_log=0
general_log_file=/forp/mysql-5.7.32/logs/general.log
back_log=900
sync_binlog=1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
interactive_timeout=30000000
wait_timeout=30000000
lower_case_table_names=1
max_connections=1000
max_connect_errors=5000
#slave-skip-errors = all
1.4.生成密码
$./mysqld --initialize --datadir=/forp/mysql-5.7.32/data
A temporary password is generated for root@localhost: speQ2;ILfUB7
1.5.启动服务
$./mysqld_safe --defaults-file=/forp/mysql-5.7.32/conf/mysql.conf &
1.6.登录
$ mysql -S /forp/mysql-5.7.32/temp/mysql.sock -uroot -p speQ2;ILfUB7
mysql>
#如果报错libncurses.so.5 【yum install libncurses*】