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

How to install the mariaDB 10.1 source code

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you the "mariaDB 10.1 source code how to install", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "mariaDB 10.1source code how to install" this article.

[root@localhost yum.repos.d] # yum-y install gcc*

[root@localhost yum.repos.d] # yum-y install ncurses-devel

[root@localhost yum.repos.d] # yum install bison bison-devel ncurses libxml2 libxml2-devel cmake # cmake requires version 2.8 or above

[root@localhost ~] # useradd mysql

[root@localhost ~] # mkdir / mariaDB/ {data,logs,socket}-p

[root@localhost] # chown mysql:mysql / mariaDB/-R

[root@localhost ~] # chmod 777 / mariaDB/socket/

[root@localhost ~] # tar-xzvf mariadb-10.1.22.tar.gz

[root@localhost ~] # cd mariadb-10.1.22

Cmake\

-DCMAKE_INSTALL_PREFIX=/mariaDB\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_XTRADB_STORAGE_ENGINE=1\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATEDX_STORAGE_ENGINE=1\

-DWITH_PARTITION_STORAGE_ENGINE=1\

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\

-DCOMPILATION_COMMENT='MariaDB 10.1 production environment'\

-DWITH_READLINE=ON\

-DSYSCONFDIR=/mariaDB/data\

-DMYSQL_UNIX_ADDR=/mariaDB/socket/socket\

-DMYSQL_DATADIR=/mariaDB/data

[root@localhost ~] # make

[root@localhost ~] # make install

[root@localhost ~] # vi / mariaDB/my.cnf

[client]

Port = 3306

Socket = / mariaDB/data/mysql.sock

[mysql]

No-auto-rehash

[mysqld]

Server-id = 1

User = mysql

Port = 3306

Socket = / mariaDB/socket/mysql.sock

Basedir = / mariaDB

Datadir = / mariaDB/data

Default-storage-engine = InnoDB

External-locking = FALSE

Skip-name-resolve

# connect options

Back_log = 600 #

Max_connections = 1000

Max_connect_errors = 10 # number which allow to connect server for error password

Connect_timeout=20 # The number of seconds that the mysqld server waits for a connect packet

Max_allowed_packet = 32m

# Table Cache Settings

Table_open_cache = 800 # # Range: 64 ~ 524288

Open_files_limit = 5000

Tmp_table_size = 2G # recommend same size as tmp_table_size

Max_heap_table_size = 2G # recommend 256 min

# Thread Cache

Thread_cache_size = 64

# thread_stack = 19K

# Query Cache

Query_cache_size = 64m

Query_cache_limit = 4m

# Per-Thread Buffers

Sort_buffer_size = 2m

Read_buffer_size = 2m

Read_rnd_buffer_size = 16m

Bulk_insert_buffer_size = 64m

Join_buffer_size = 2m

Thread_stack = 512k

# # transaction infomation

Transaction_isolation = READ-COMMITTED

# slog log

Slow_query_log_file=/mariaDB/logs/slow-log.log

Slow_query_log=1

Long_query_time=4 # set time when executing is more this time,the sql be writen in slow log

Log_queries_not_using_indexes=1 # when executing sql,the table have not index for the sql,the sql will be writen in slow log

# # bin log

Log-bin = / mariaDB/logs/ray-bin.log

Binlog_cache_size = 10m

Max_binlog_cache_size = 8m

Max_binlog_size = 128m

Expire_logs_days = 7

Binlog_format = ROW

Binlog_stmt_cache_size = 10m

Key_buffer_size = 256MB

Lower_case_table_names = 1

# innodb options

Innodb_buffer_pool_instances=8

Innodb_file_per_table = on

Innodb_thread_concurrency = 8

Innodb_read_io_threads = 16 # # number of 2*cpu * number of cpu cores, which is recommended to be equal to or twice the number of cpu kernels

Innodb_write_io_threads = 16

# # innodb memery

Innodb_buffer_pool_size = 512m

Innodb_max_dirty_pages_pct = 70

Innodb_lock_wait_timeout = 120

# # redo log

Innodb_log_buffer_size = 16m

Innodb_log_file_size = 128m

Innodb_log_files_in_group = 3

Innodb_flush_log_at_trx_commit = 1

Autocommit=0

# set independent undo

Innodb_undo_directory=/mariaDB/data

Innodb_undo_logs=128

Innodb_undo_tablespaces=4

[mysqldump]

Quick

Max_allowed_packet = 32m

[mysqld_safe]

Log-error=/mariaDB/logs/mysql_ray.err

Pid-file=/mariaDB/data/ray.pid

/ mariaDB/scripts/mysql_install_db-user=mysql-basedir=/mariaDB-datadir=/mariaDB/data-innodb_undo_tablespaces=4-defaults-file=/mariaDB/my.cnf

/ mariaDB/bin/mysqld_safe-- defaults-file=/mariaDB/my.cnf 2 > & 1 > / dev/null &

Vi / mariaDB/mysqld

#! / bin/bash

Mysql_port=3306

Mysql_username= "root"

Mysql_password= "123456"

Function_start_mysql ()

{

Printf "Starting MySQL...\ n"

/ bin/sh / mariaDB/bin/mysqld_safe-- defaults-file=/mariaDB/my.cnf 2 > & 1 > / dev/null &

}

Function_stop_mysql ()

{

Printf "Stoping MySQL...\ n"

/ mariaDB/bin/mysqladmin-u ${mysql_username}-p$ {mysql_password}-S / mariaDB/socket/mysql.sock shutdown

}

Function_restart_mysql ()

{

Printf "Restarting MySQL...\ n"

Function_stop_mysql

Function_start_mysql

}

Function_kill_mysql ()

{

Kill-9 $(ps-ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk' {printf $2}')

Kill-9 $(ps-ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk' {printf $2}')

}

Case $1 in

Start)

Function_start_mysql

Stop)

Function_stop_mysql

Kill)

Function_kill_mysql

Restart)

Function_stop_mysql

Function_start_mysql

*)

Echo "Usage: / mariaDB/mysqld {start | stop | restart | kill}"

Esac

Modify root password

[root@MariaDB] # mysqladmin-uroot password '123456'

[root@MariaDB] # mysql-uroot-pendant 123456'-S / mariaDB/socket/mysql.sock

The above is all the contents of the article "how to install the mariaDB 10.1 source code". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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