Centos 7.3 安装mysql5.7.19 各种调试就不多说了

mysql 5.7.19linux-glibc2.12 (x86_64) 安装

1、在安装目录进行解压
2、mv解压目录为mysql
3、创建mysql的用户 useradd -s /sbin/nolong -M mysql
4、chown -R mysql.mysql /application/mysql
5、这个版本的mysql,suppprt下没有配置文件,需要自己上传一个配置文件,放到/etc 下并改名为/my.conf 以下为配置文件内容
[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld_safe]
server_id=10
port = 3306
user = mysql
character-set-server = utf8mb4
default_storage_engine = innodb
log_timestamps = SYSTEM
socket = /tmp/mysql.sock
basedir = /application/mysql
datadir = /data/mysql
pid-file = /data/mysql/mysql.pid
max_connections = 1000
max_connect_errors = 1000
table_open_cache = 1024
max_allowed_packet = 128M
open_files_limit = 65535
#####====================================[innodb]==============================
innodb_buffer_pool_size = 1024M
innodb_file_per_table = 1
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_purge_threads = 2
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16M
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 30
innodb_data_file_path=ibdata1:1024M:autoextend

#####====================================[log]==============================
log_error = /data/mysql/log/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/log/mysql-slow.log

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

6、创建mysql的数据库存放地点和log存放地点
mkdir -p /data/mysql/log
chown -R mysql.mysql /data/mysql
touch /data/mysql/log/{mysql-error.log,mysql-slow.log}
7、初始化数据库,这个版本不能再用mysql_install_db了,需要用mysqld这个来进行初始化
/application/mysql/bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/data/mysql --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp
8、将/application/mysql/support-files/下的 mysql.server 复制到/etc/init.d/下 改名为mysqld
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
为basdir和datadir 进行定义
basedir=/application/mysql
datadir=/data/mysql
9、启动mysql
/etc/init.d/mysqld start
lsof -i :3306

配置文件有问题的地方求大神指导,谢谢!!!

上一篇:J20航模遥控器开源项目系列教程(一)制作教程 | 基础版V1.0发布,从0到1


下一篇:Linux命令-mv