หลังจาก install mysql ตามปกติถ้าเป็น CentOS ก็ yum เอาเลย
# yum install mysql mysql-server
set auto start service
#chkconfig --levels 235 mysqld on
# /etc/init.d/mysqld start
and set root password for security
# mysql_secure_installation
Set root password? [Y/n] <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
... Success!
ต่อไปใส่ค่า my.cnf สำหรับ tuning mysql และ enable innodb
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#ignore-builtin-innodb
#plugin-load=innodb=ha_innodb_plugin.so
################################################
#### Tuning parameter by Pramote ep.2 (Ram8Gb) ####
################################################
skip-locking
#skip-thread-priority
skip-name-resolve
#bind-address=10.77.170.231
key_buffer=512M
max_allowed_packet = 1M
sort_buffer_size=4M
read_buffer_size=4M
read_rnd_buffer_size=8M
myisam_sort_buffer_size = 128M
thread_cache = 4
tmp_table_size=1024M
max_tmp_tables=1024M
table_cache=1024M
query_cache_size=256M
thread_concurrency = 16 # Number of CPU*2
max_tmp_tables = 1024M
connect_timeout =60
wait_timeout=60
interactive_timeout=60
max_user_connections=2000
max_connections=2000
max_connect_errors=10
### Add Slow Query Log by DBA ###
set-variable=long_query_time=30
log-slow-queries=/var/log/slow-queries-log.log
############ Set security database by MONyog ###############
secure-auth=1
local-infile = 0
##########amam########################
#general_log =1
#general_log_file =/var/log/queries-log.log
#### Replicate Master mode ###
server-id = 1
log-bin=mysql-bin
expire_logs_days = 5
server-id = 1
binlog-ignore-db = mysql
replicate-ignore-db = mysql
#################################Tuning InnoDB########################
innodb_file_per_table
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 1G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
### innodb_force_recovery=1
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
### innodb_fast_shutdown
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
### innodb_log_group_home_dir
innodb_max_dirty_pages_pct = 90
### innodb_flush_method=O_DSYNC
innodb_lock_wait_timeout = 120
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
restart service mysql สักรอบ
# /etc/init.d/mysql restart
แล้วดูว่า innodb enable แล้วหรือยัง login เข้า mysql แล้วเช็คดู
# mysql -u root -p
:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)
ในกรณีที่ innodb ยังไม่โผล่ในลิสที่ support ให้เราไปทำการลบไฟล์ ib_* log ไฟล์ทั้งหมดในโฟลเดอร์ /var/lib/mysql ออกให้หมดแล้วทำการ restart service mysql อีกรอบ
# rm -rf ib_*
# /etc/init.d/mysql restart
แล้วเช็คดูอีกทีว่า innodb มาแล้วหรือยัง
mysql -u root -p
:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)
innoDB โผล่ขึ้นมาว่า support แล้วครับพร้อมใช้งานต่อไป
ไม่มีความคิดเห็น:
แสดงความคิดเห็น