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

MySQL5.7.18 for Linux7.2 source code installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

It is troublesome to install MySQL in source code. You need to install the dependency package, and then compile it for a long time. It is recommended to install binary MySQL, which is relatively fast.

Software packages used:

Mysql-5.7.18.tar.gz

Boost_1_59_0.tar.gz

1. Install the dependency package

Yum-y install gcc* gcc-c++ ncurses* ncurses-devel* cmake* bison* libgcrypt* perl*

2. Create a MySQL user:

[root@localhost] # mkdir-p / mysql/data

[root@localhost] # mkdir-p / mysql/mysql5718

[root@localhost] # chown-R mysql.mysql / mysql/

3. Adjust the system parameters

[root@localhost ~] # vim / etc/security/limits.conf

* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535

[root@localhost ~] # vi / etc/security/limits.d/20-nproc.conf

* soft nproc 65535

[root@localhost ~] # vi / etc/profile

Ulimit-u 65535

Ulimit-n 65535

4. Download and extract the software

[root@localhost] # tar zxvf mysql-5.7.18.tar.gz-C / usr/src/

[root@localhost] # tar zxvf boost_1_59_0.tar.gz-C / mysql/

[root@localhost] # chown-R mysql.mysql / mysql/

[root@localhost] # chmod-R 755 / mysql/

[root@localhost] # chown-R mysql.mysql / usr/src/mysql-5.7.18/

5. Start compiling and installing MySQL5.7.18

[root@localhost ~] # su-mysql

[mysql@localhost ~] $cd / usr/src/mysql-5.7.18/

[mysql@localhost mysql-5.7.18] $cmake. -DCMAKE_INSTALL_PREFIX=/mysql/mysql5718\

-DMYSQL_DATADIR=/mysql/data\

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/mysql/boost_1_59_0

[mysql@localhost mysql-5.7.18] $make-j 4 (compiling 4 processes in parallel)

[mysql@localhost mysql-5.7.18] $make install

6. Initialize the database:

[mysql@localhost] $/ mysql/mysql5718/bin/mysqld-initialize-user=mysql-basedir=/mysql/mysql5718/-datadir=/mysql/data/

-Note: the default password of the database will be generated when initializing the database. This password should be remembered and used to log in to the database later.

7. Edit the my.cnf configuration file and start the database

[mysql@localhost ~] $vim my.cnf (this profile is for reference only)

[client]

Socket = / mysql/data/mysql.sock

Default_character_set = utf8

[mysql]

Socket=/mysql/data/mysql.sock

[mysqld]

Server_id = 1607

Port = 3306

Basedir = / mysql/mysql5718/

Datadir = / mysql/data/

Socket = / mysql/data/mysql.sock

Pid_file = / mysql/data/mysql.pid

Log_error = / mysql/data/mysql_error.log

Log_bin = / mysql/data/mysql_bin

Relay_log = / mysql/data/relay_bin

Character_set_server = utf8

Collation_server = utf8_general_ci

Innodb_buffer_pool_size = 8G

Innodb_buffer_pool_instances = 8

Innodb_log_file_size = 1G

Innodb_log_files_in_group = 3

Innodb_log_buffer_size = 24m

Innodb_flush_log_at_trx_commit = 1

Innodb_file_per_table = 1

Innodb_flush_method = O_DIRECT

Innodb_io_capacity = 200

Innodb_io_capacity_max = 600,

Innodb_thread_concurrency = 0

Innodb_autoinc_lock_mode = 2

Innodb_lock_wait_timeout = 60

Innodb_read_io_threads = 4

Innodb_write_io_threads = 4

Innodb_max_dirty_pages_pct = 80

Innodb_autoextend_increment = 512

Innodb_checksum_algorithm = NONE

Innodb_doublewrite = 0

Innodb_use_native_aio = 1

Innodb_open_files = 8192

Sync_binlog = 1

Sync_relay_log = 1

Relay_log_info_repository = TABLE

Master_info_repository = TABLE

Expire_logs_days = 10

Binlog_format = ROW

Transaction-isolation = READ-COMMITTED

Concurrent_insert = 2

Skip_slave_start = TRUE

Back_log = 2000

Thread_stack = 256k

Thread_cache_size = 256

Key_buffer_size = 256m

Tmp_table_size = 64m

Read_buffer_size = 2m

Read_rnd_buffer_size = 8m

Sort_buffer_size = 2m

Join_buffer_size = 2m

Query_cache_size = 0

Query_cache_type = 0

Max_heap_table_size = 64m

Binlog_cache_size = 2m

Table_open_cache = 8192

Max_allowed_packet = 64m

Bulk_insert_buffer_size = 64m

Max_connect_errors = 100000

Max_connections = 500,

Connect_timeout = 300

Wait_timeout = 86400

Interactive_timeout = 86400

Lower_case_table_names = 1

Open_files_limit = 20480

Skip_name_resolve

Skip_external_locking

Explicit_defaults_for_timestamp = TRUE

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysql@localhost] $/ mysql/mysql5718/bin/mysqld_safe-- defaults-file=/mysql/data/my.cnf-- user=mysql &

8. Enter the database to check:

[mysql@localhost] $/ mysql/mysql5718/bin/mysql-u root-p-- socket=/mysql/data/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 7

Server version: 5.7.18-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > set password='123456'; (because the password we just used is the default login password, we need to change it)

Mysql > flush privileges

Then log in to the database again and check:

[mysql@localhost] $/ mysql/mysql5718/bin/mysql-u root-p-- socket=/mysql/data/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >\ s

-

/ mysql/mysql5718/bin/mysql Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86 / 64) using EditLine wrapper

Connection id: 7

Current database:

Current user: root@localhost

SSL: Not in use

Current pager: stdout

Using outfile:''

Using delimiter:

Server version: 5.7.18-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: utf8

Conn. Characterset: utf8

UNIX socket: / mysql/data/mysql.sock

Uptime: 25 min 16 sec

Threads: 1 Questions: 19 Slow queries: 0 Opens: 110 Flush tables: 1 Open tables: 103 Queries per second avg: 0.012

-

Mysql >

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