mysql安装

10.4.247.130 安装Mysql 5.7.19
==========================================


CPU:4core Mem:32G
OS:
root / Ideal_1234
mysql / mysql123abc
DB:


===========================================
# 新建mysql账户
groupadd -g 3000 mysql
useradd -u 3000 -s /bin/bash -g mysql -G mysql mysql
echo "mysql123abc" | passwd --stdin mysql


#新建mysql账户
useradd -u 4000 -s /bin/bash -g root -G root ldmonitor
echo "ld_monit_356" | passwd --stdin ldmonitor


Mysql 解压到指定目录:
mkir /u01/mysql
chown mysql.mysql /u01/mysql
cd /u01/mysql
tar -xzvf /home/mysql/soft/mysql-advanced-5.7.19-linux-glibc2.12-x86_64.tar.gz
mv mysql-advanced-5.7.19-linux-glibc2.12-x86_64/ mysql-5.7.19
cd mysql-5.7.19;mkdir log


修改Mysql 配置文件:
touch /etc/my.cnf
chown mysql.mysql /etc/my.cnf


简单配置:
--------------------
[mysqld]
basedir=/u01/mysql/mysql-5.7.19
datadir=/u01/mysql/mysql-5.7.19/data
user=mysql
port=3306
explicit_defaults_for_timestamp
--------------------
详细配置:
--------------------
[mysql]
port=3306
prompt=\\u@\\d \\r:\\m:\\s>
default-character-set=utf8
no-auto-rehash


[mysqld]
#dir
basedir = /u01/mysql/mysql-5.7.19
datadir = /u01/mysql/mysql-5.7.19/data
tmpdir=/tmp
#skip_name_resolve=off


#error log
log-error=/u01/mysql/mysql-5.7.19/log/mysql.err


#binlog
log-bin=/u01/mysql/mysql-5.7.19/log/mysql-bin
server_id=11
binlog_cache_size=256K
max_binlog_cache_size=512M
max_binlog_size=512M
binlog-format=ROW
sync_binlog=1000
log-slave-updates=1
expire_logs_days=3


#general log
log_output=file
general_log=off
general_log_file=/u01/mysql/mysql-5.7.19/log/general.log


#slow log
slow_query_log=off
slow_launch_time=10
slow_query_log_file=/u01/mysql/mysql-5.7.19/log/slow.log
log_queries_not_using_indexes=on


#server
default-storage-engine=INNODB
character-set-server=utf8mb4
lower_case_table_names=1
event_scheduler=on
log_bin_trust_function_creators = 1
explicit_defaults_for_timestamp




#innodb
innodb_data_home_dir=/u01/mysql/mysql-5.7.19/data
innodb_log_group_home_dir=/u01/mysql/mysql-5.7.19/data
innodb_data_file_path=ibdata1:128M;ibdata2:128M:autoextend
innodb_buffer_pool_size=10G        
innodb_buffer_pool_instances=1
innodb_log_files_in_group=4
innodb_log_file_size=200M
innodb_log_buffer_size=10M
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=60
innodb_io_capacity=1000
innodb_thread_concurrency=8 #2*cpu
innodb_read_io_threads=5
innodb_write_io_threads=3
innodb_open_files=20000
#innodb_file_format=Barracuda
innodb_file_per_table=1
innodb_autoextend_increment=32
innodb_flush_method=O_DIRECT
innodb_change_buffering=inserts
innodb_adaptive_flushing=1
innodb_old_blocks_time=1000
innodb_stats_on_metadata=0
#innodb_read_ahead_threshold=
innodb_use_native_aio=0
innodb_lock_wait_timeout=5
innodb_rollback_on_timeout=0
innodb_purge_threads=1
innodb_strict_mode=1
transaction-isolation=READ-COMMITTED


#myisam
key_buffer_size=2048M
myisam_sort_buffer_size=64M
concurrent_insert=AUTO
# delayed_insert_timeout=300




max_connections=3000
max_user_connections=1000
--------------------


Mysql初始化
su - mysql
vi ~/.bash_profile
--------------------
PATH=$PATH:$HOME/bin:/u01/mysql/mysql-5.7.19/bin
--------------------
source ~/.bash_profile
mysqld --initialize
mysql_ssl_rsa_setup --datadir=/u01/mysql/mysql-5.7.19/data


Mysql 启动
--------------------
mysqld_safe &
--------------------


查看/u01/mysql/mysql-5.7.19/log/mysql.err
--------------------
2017-08-17T03:51:01.554127Z 1 [Note] A temporary password is generated for root@localhost: .y1F>C(&dFhQ
--------------------


修改root密码
--------------------
mysql -uroot -p
set password=password('root');
flush privileges;
--------------------


添加到服务
su -
cp /u01/mysql/mysql-5.7.19/support-files/mysql.server /etc/init.d/mysql
service mysql restart

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30592920/viewspace-2143900/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30592920/viewspace-2143900/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值