How to configure MySQL Server in Linux / Installing MySQL from Source Code
In this tutorial I describe “How to configure MySQL Server in Linux / Installing MySQL from Source Code” or step by step MySQL Server installation. If you have root privileges or equal then you can install MySQL Server By Source code. First requirement is download latest MySQL source bundle.
1) Before installation source bundle you need developer related package then install into your server. These package are gcc, gcc-c++, cmak , etc.
#yum install –y gcc*, cmake
2) After completing first step you need to install your MySQL source bundle.
3) Decompress your MySQL source bundle
#tar zxvf mysql- 4) After decompression bundle then go to bundle related directory#cd MySQL-*
5) After change directory. We use cmake for cross platform build system generator
#cmake ..
6) make utility to maintain group of programs.
# make
#make install
8) By default MySQL install into /usr/local/mysql. If you want to specific user can maintain MySQL Server then you need to user name and user group name and set permission on directory only user can execute services other user cannot.
#cd /usr/local/mysql
#cp –rf * /usr/local/webmaster/mysql
9) After copy all item from /usr/local/mysql to /usr/local/webmaster/mysql then you need to create a link.
#ln –sf /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
10) Execute another command
#ldconfig
11) Modify the Mysql directory permission and owner.
#chmod +w /usr/local/webserver/mysql
#chown –R mysql:mysql /usr/local/webserver/mysql
12) If you do not install mysql then not need configuration.
13) Create a database Mysql to store directory and create data tables.
# mkdir -p /data0/mysql/3306/data
#mkdir -p /data0/mysql/3306/binlog/
#mkdir -p /data0/mysql/3306/relaylog/
#chown –R mysql:mysql /data0/mysql/
14) Now time to run database script with location directory like as basedir and datadir.
#/usr/local/webserver/mysql/script/mysql_install_db -basedir=/usr/local/webserver/mysql – datadir=/data0/mysql/3306/data –user= mysql
15) Now time to configure MySQL primary configuration file.
#vim /etc/my.cnf
[Client]
default-character-set = utf8
port = 3306
socket = / tmp / mysql.sock[client]
default-character-set=utf8
port=3306
socket=/tmp/mysql.sock
[Mysqld]
# ——— Base ———— #
character-set-server = utf8
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/webserver/mysql
datadir = /data0/mysql/3306/data
pid-file = /data0/mysql/3306/mysql.pid
# ———- Log ———– #
log-output = file
# Expire_logs_days = 30
log-error = /data0/mysql/3306/mysql_error.log
# General_log = 1
# General_log_file = /data0/mysql/3306/mysql.log
# Log-slow-queries = /data0/mysql/3306/slow.log
# Long_query_time = 10
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
log-bin = /data0/mysql/3306/binlog/binlog
log-bin-index = /data0/mysql/3306/binlog/binlog
relay-log = /data0/mysql/3306/relaylog/relaylog
relay-log-index = /data0/mysql/3306/relaylog/relaylog
relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
# # ———- ———– Transmission network
back_log = 600
max_connections = 5000
max_connect_errors = 6000
max_allowed_packet = 32M
interactive_timeout = 120
wait_timeout = 120
skip-name-resolve
####———- ———– # # Query Optimization
open_files_limit = 10240
table_cache = 614
external-locking = FALSE
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
# Thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
# ———– Storage-engine ——— #
default-storage-engine = MyISAM
# ———– Myisam-engine ——— #
key_buffer_size = 512M
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
myisam_repair_threads = 1
myisam_recover
# ———– Innodb-engine ——— #
innodb_data_file_path = ibdata1: 256M: autoextend
innodb_additional_mem_pool_size = 16M
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
Now given configuration file have many setting. you can implement these setting which you want to in your server.
16) Create MySQL daemon for start and stop MySQL service.
#cp /usr/local/webserver/mysql/support-files/mysql.server /etc/init.d/mysqld
17) Set service property means running MySQL daemon on boot time.
#chkconfig –level 345 mysqld on
#service mysqld restart
#service mysqld status
18) Now time to add user into MySQL environment.
#mysqladmin –u root password “redhat”
19) Check user working or not.
#mysql –u root –p
Put password then accesss
Thanks for visit my site. If you have any query about my post “How to configure MySQL Server in Linux” or about my blog please reply me.
Share
- Share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to share on Google+ (Opens in new window)
- Click to share on Pocket (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on StumbleUpon (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- More


