linux安装mysql5.7.23_Linux安装Mysql5.7.23

下载mysql5.7.23

一、下载解压tar.gz

去mysql官网下载mysql-5.7.23-el7-x86_64.tar.gz;

通过xftp上传到usr/local/文件夹目录;

解压mysql-5.7.23-el7-x86_64.tar.gz至mysql;

二、配置

在user/mysql下面创建data文件夹;(安装数据用)

新增mysql用户及用户组。赋予权限

groupadd mysql

useradd mysql -g mysql

chmod -R 755 mysql

复制代码

修改/etc/my.cnf文件

[client]

no-beep

socket =/usr/local/mysql/mysql.sock

# pipe

# socket=0.0

port=3306

[mysql]

default-character-set=utf8

[mysqld]

lower_case_table_names =1

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

port=3306

pid-file=/usr/local/mysql/mysqld.pid

socket=/usr/local/mysql/mysql.sock

character-set-server=utf8

default-storage-engine=INNODB

explicit_defaults_for_timestamp = true

# Server Id.

server-id=1

max_connections=2000

query_cache_size=0

table_open_cache=2000

tmp_table_size=246M

thread_cache_size=300

#限定用于每个数据库线程的栈大小。默认设置足以满足大多数应用

thread_stack = 192k

key_buffer_size=512M

read_buffer_size=4M

read_rnd_buffer_size=32M

innodb_data_home_dir =/usr/local/mysql/data

innodb_flush_log_at_trx_commit=0

innodb_log_buffer_size=16M

innodb_buffer_pool_size=256M

innodb_log_file_size=128M

innodb_thread_concurrency=128

innodb_autoextend_increment=1000

innodb_buffer_pool_instances=8

innodb_concurrency_tickets=5000

innodb_old_blocks_time=1000

innodb_open_files=300

innodb_stats_on_metadata=0

innodb_file_per_table=1

innodb_checksum_algorithm=0

back_log=80

flush_time=0

join_buffer_size=128M

max_allowed_packet=1024M

max_connect_errors=2000

open_files_limit=4161

query_cache_type=0

sort_buffer_size=32M

table_definition_cache=1400

binlog_row_event_max_size=8K

sync_master_info=10000

sync_relay_log=10000

sync_relay_log_info=10000

#批量插入数据缓存大小,可以有效提高插入效率,默认为8M

bulk_insert_buffer_size = 64M

interactive_timeout = 120

wait_timeout = 120

log-bin-trust-function-creators=1

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]

log-error=/usr/local/mysql/data/error.log

pid-file=/usr/local/mysql/mysqld.pid

# 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

#

# include all files from the config directory

#

#includedir /etc/my.cnf.d

复制代码

初始化数据库

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

启动数据库

cd /usr/local/mysql/support-files

./mysql.server start

复制代码

登录数据库

./mysql -u root -p

复制代码

改新密码

set password = password('newPassword');

复制代码

能让navicat链接使用

create user test identified by 'password';

grant all privileges on *.* to 'test';

flush privileges;

复制代码

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值