mysql二进制安装

下载二进制文件

链接: https://pan.baidu.com/s/10z8OBnIWcGn5WzL33xiNHA 提取码: f767 复制这段内容后打开百度网盘手机App,操作更方便哦
解压
tar -zxvf mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz -C /usr/local/

修改目录名字

cd /usr/local/
mv mysql-5.7.31-linux-glibc2.12-x86_64 mysql

 创建mysql数据目录

mkdir -p /data/mysql

修改配置文件

[mysql]
port = 3309
[mysqld]
port = 3309
socket = /tmp/mysql.sock
datadir = /data/mysql/
server-id = 101
log-bin=mysql-bin
open_files_limit = 10240
back_log = 600
max_connections = 10000
max_connect_errors = 1000
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 300
query_cache_size = 64M
query_cache_limit = 4M
query_cache_min_res_unit = 2k 
transaction_isolation = REPEATABLE-READ
tmp_table_size = 256M
max_heap_table_size = 256M
expire_logs_days = 7
key_buffer_size = 2048M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
skip-name-resolve
lower_case_table_names = 1 
innodb_buffer_pool_size = 4G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 32
innodb_flush_log_at_trx_commit = 1 
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
innodb_io_capacity=2000
[mysqldump]
quick
[mysqld_safe]
log-error=/data/mysql/gssgy_mysql.err
pid-file=/data/mysql/mysqld.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLE

初始化数据库

#注 : 初始后会有root密码
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf  --initialize  --user=root

 

启动mysql

/usr/local/mysql/bin/mysqld_safe  --defaults-file=/etc/my.cnf  --user=root &

 修改mysql密码

mysqladmin -uroot -p'xxxx' password '1234.com'
或
进入mysql
set password for root@'localhost' = password('1234.com');
或
update mysql.user set authentication_string=password('123.com') where user='root' and Host ='localhost';
mysql> flush privileges;  #刷新权限

关闭mysql

/usr/local/mysql/bin/mysqladmin  -uroot -p'123456' shutdown

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值