1下载二进制tar包,并上传到/data/software目录
下载mysql安装包:
https://dev.mysql.com/downloads/mysql/ 下载对应的版本号
当前操作目录基于 /data/software/
# tar -zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
# mv mysql-8.0.11-linux-glibc2.12-x86_64 mysql-8.0.11
2.创建数据目录
#cd /data/mysqld
#mkdir 3307
#cd 3307
#mkdir data
#mkdir tmp
#mkdir log
#touch my.cnf
#vi my.cnf
[mysqld]
server_id = 270
user = mysql
port = 3307
basedir = /data/software/mysql-8.0.11
datadir = /data/mysqld/3307/data
log-bin = /data/mysqld/3307/data/binlog
socket = /data/mysqld/3307/tmp/mysql.sock
pid-file = /data/mysqld/3307/tmp/mysql.pid
log-error = /data/mysqld/3307/log/mysql_error.log
relay-log = /data/mysqld/3307/relaylog
relay-log-index = /data/mysqld/3307/relaylog.index
default-storage-engine = Innodb
innodb_file_per_table = 1
#慢查询
long_query_time = 1
slow-query-log = on
slow_query_log_file = /data/mysqld/3307/log/mysql_slow.log
#记录更多的日志
log_slow_admin_statements
#master/slave
slave_skip_errors=1032,1062
log-slave-updates
master-info-repository=TABLE
enforce_gtid_consistency
gtid-mode=ON
#report_host=10.100.135.29
#report_port=3307
#charset
character-set-server = utf8
#log_warnings = 0
open_files_limit = 10240
#参考:短时间内最大连接
back_log = 1024
#binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
expire_logs_days = 1
#buffer
join_buffer_size = 32M
sort_buffer_size = 32M
read_rnd_buffer_size = 16M
#innodb Dynamic=NO
innodb_buffer_pool_instances = 8
innodb_read_io_threads = 8
innodb_write_io_threads = 4
innodb_buffer_pool_size = 8192M
#数据刷新方式
innodb_flush_method = O_DIRECT
#单个连接所分配的内存大小
innodb_sort_buffer_size = 4M
#只限slave配置
innodb_flush_log_at_trx_commit = 2
#thread
thread_cache_size = 256
#connections
max_connections = 2048
max_connect_errors = 10240
init-connect='SET NAMES utf8'
#跳过反向解析
skip-name-resolve = 1
explicit_defaults_for_timestamp = TRUE
#调用group_cat
group_concat_max_len = 204800
3、修改权限
# cd /data/
# chown -R mysql.mysql mysqld/
4.初始化数据库
/data/software/mysql-8.0.11/bin/mysqld --defaults-file=/data/mysqld/3307/my.cnf --initialize --explicit_defaults_for_timestamp --user=mysql
执行成功以后,查看mysql-error.log ,查看对应的初始密码
[MY-010454] [Server] A temporary password is generated for root@localhost: lcLi*fQei9:h
5.启动数据库
/data/software/mysql-8.0.11/bin/mysqld_safe --defaults-file=/data/mysqld/3307/my.cnf &
6.登录数据库,修改密码
/data/software/mysql-8.0.11/bin/mysql -uroot -S/data/mysqld/3307/mysql.sock -plcLi*fQei9:h
mysql> ALTER USER "root"@"localhost" IDENTIFIED BY "123456";
以上是个人在安装8.0的笔记,如有问题,欢迎讨论