Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql binary installation

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download the binaries and extract the files:

Download address: https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Tar xvzf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

Mv mysql-5.7.23-linux-glibc2.12-x86_64 / usr/local/

Cd / usr/local/

Ln-s mysql-5.7.23-linux-glibc2.12-x86_64 mysql

Chown-R mysql:mysql / usr/local/mysql/

Vim / etc/my.cnf

# # mysql5.7.23#

[client]

Port=3306

Socket=/app/data/run/mysql.sock

[mysql]

# pid_file=/app/data/run/mysqld.pid

[mysqld]

Gtid_mode=on

Enforce_gtid_consistency=on

Log_slave_updates=on

Autocommit=1

General_log=off

Explicit_defaults_for_timestamp=true

# character

Default-storage-engine=INNODB

Innodb_file_per_table=1

Character-set-server=utf8

Collation-server=utf8_general_ci

Interactive_timeout = 559200

Wait_timeout = 559200

# system

Basedir=/usr/local/mysql

Datadir=/app/data/data

Max_allowed_packet=1g

Max_connections=3000

Max_user_connections=2800

Open_files_limit=65535

Pid_file=/app/data/run/mysqld.pid

Port=3306

Server_id=52160

# skip_name_resolve=ON

Socket=/app/data/run/mysql.sock

Tmpdir=/app/data/tmp

# innodb

Innodb_data_home_dir=/app/data/log/iblog

Innodb_log_group_home_dir=/app/data/log/iblog

Innodb_buffer_pool_size = 1000m

# binlog

Log_bin=/app/data/log/binlog/binlog

Binlog_format=row

Expire_logs_days=7

Innodb_log_file_size = 200m

Innodb_log_files_in_group = 4

Max_binlog_size=200M

# logging

Log_error=/app/data/log/error.log

Slow_query_log_file=/app/data/log/slow.log

Log_queries_not_using_indexes=0

Slow_query_log=1

Log_slave_updates=ON

Log_slow_admin_statements=1

Long_query_time=1

# relay

Relay_log=/app/data/log/relaylog

Relay_log_index=/app/data/log/relay.index

Relay_log_info_file=/app/data/log/relay-log.info

[mysqld_safe]

Datadir=/app/data/data

# mysql5.7.23#

-- add users:

Groupadd mysql

Useradd-r-g mysql-s / bin/false mysql

-

Or directly:

Useradd mysql

Cp-a / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld

-- create a data directory:

Mkdir-p / app/data/log

Mkdir-p / app/data/log/binlog

Mkdir-p / app/data/run

Mkdir-p / app/data/tmp

Mkdir-p / app/data/log/iblog

Chown-R mysql:mysql / app/data/

-- initialize the database:

[root@test1 ~] # su-mysql

[mysql@test1] $/ usr/local/mysql/bin/mysqld-- defaults-file=/etc/my.cnf-- initialize-- user=mysql

2.1 start through the script:

Start the database:

[mysql@test1 log] $/ etc/init.d/mysqld start

Starting MySQL.. [OK]

Shut down the database:

[mysql@test1 log] $/ etc/init.d/mysqld stop

Shutting down MySQL.. [OK]

Log in to the database:

[mysql@test1 log] $/ usr/local/mysql/bin/mysql-uroot-p

Change the password:

Mysql > alter user root@'localhost' identified by 'MYsql#123'

Query OK, 0 rows affected (0.00 sec)

2.2 Custom profile launch:

Start the database:

[mysql@test1 log] $/ usr/local/mysql/bin/mysqld_safe-- defaults-file=/etc/my.cnf-- user=mysql &

Shut down the database:

[mysql@test1 log] $/ usr/local/mysql/bin/mysqladmin-port=3306 shutdown-p

Enter password:

3. Power on and start automatically:

[root@test1 ~] # chkconfig mysqld on

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report