徒手安装mysql 5.7过程

清理MYSQL

rpm -qa|grep mysql
rpm -e mysql-5.1.73-8.el6_8.x86_64

chkconfig --list | grep -i mysql

清除MYSQL包

whereis mysql
rm -rf /usr/lib/mysql

完成目录

Mysql目录安装位置:/usr/local/mysql

数据库保存位置:/usr/local/mysql/data

日志文件: /usr/local/mysql/logs

cd /usr/local
mkdir mysql
cd mysql
mkdir data
mkdir logs

下载文件到 /usr/local 下mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

解压

tar -xzvf  mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.13-linux-glibc2.5-x86_64/* /usr/local/mysql

用户组 用户

groupadd mysql
useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql

修改权限

创建三个文件

cd /usr/local/mysql/logs
vi error.log
vi mysql.log
cd /usr/local/mysql
chown -R mysql:mysql ./

初始化

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data


临时密码: 2ZpjiHuR)7+T

配置MySQL

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

修改配置

vim /etc/init.d/mysqld

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

bin/mysqld_safe --user=mysql &
//或者
service mysqld start

编辑my.cnf文件内容

[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

server-id=1
log-bin=MySQL-bin
binlog-do-db=etp


user    = mysql
port    = 3306
socket    =/usr/local/mysql/data/mysql.sock
pid-file =/usr/local/mysql/data/mysql.pid
basedir    = /usr/local/mysql
datadir    = /usr/local/mysql/data/
character_set_server = utf8mb4
collation_server = utf8mb4_bin
back_log = 1024
explicit_defaults_for_timestamp = ON
lower_case_table_names = 0
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

max_connections = 512
max_connect_errors = 1000000
table_open_cache = 1024
max_allowed_packet = 8M
thread_stack = 256K
thread_cache_size = 384

skip-external-locking

interactive_timeout = 600
wait_timeout = 3600
log_timestamps = SYSTEM
log-error =/usr/local/mysql/logs/error.log

default_storage_engine = InnoDB
innodb_buffer_pool_size = 64M
innodb_purge_threads = 1
innodb_log_buffer_size = 2M
innodb_log_file_size = 128M
innodb_lock_wait_timeout = 120

bulk_insert_buffer_size = 32M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1

[client]
port=3306
socket=/usr/local/mysql/mysql.sock

[mysqld_safe]
log-error=/usr/local/mysql/logs/mysql.log

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

启动mysql

service mysqld start

登录mysql,并修改root密码

cd /usr/local/mysql/bin
./mysql -h127.0.0.1 -uroot -p
输入初始密码

set password= password('XXXXXXXXX');

create database etpDEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

us

ALTER TABLE t_etp_cloudorder ADD COLUMN `flowingoffsetflag` varchar(10) DEFAULT '1' COMMENT '浮动止盈止损条件单的开平动作; 0为平仓,1为开仓';

alter table t_etp_trade modify column exchangeinstid varchar(300);

alter table t_etp_histrade modify column exchangeinstid varchar(300);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值