mysql5.5多实例配置_mysql-5.5.32多实例配置
一、安裝依賴包
yum install ncurses-devel libaio-devel -y
二、下載cmake2.8.8和mysql.5.5.32
PS:我這里直接下載好了所以就用rz上傳了
三、解壓cmake-2.8.8.tar.gz
tar xf cmake-2.8.8..tar.gz
四、編譯cmake
cd cmake-2.8.8
./configure
gmake && gmake install
五、解壓mysql-5.5.32
tar xf mysql-5.5.32.tar.gz
六、創建mysql用戶
useradd -s /sbin/nologin -M mysql
七、進入mysql-5.5.32目錄并編譯
cd /home/ljx/tools/mysql-5.5.32
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \
-DMYSQL_DATADIR=/application/mysql-5.5.32/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock \
-DEXTRA_CHARSETS=gbk.gb2312.utf8.ascii \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
make && make install
八、復制my.cnf
cp /home/ljx/tools/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
九、設置軟鏈接
ln -s /application/mysql-5.5.32/ /application/mysql
十、配置環境變量并讓其生效
echo ‘export PATH=/application/mysql/bin:$PATH‘>>/etc/profile
source /etc/profile
十一、授權
chown -R mysql.mysql /application/mysql/data/
chmod -R 1777 /tmp/
十二、創建mysql多實例的數據文件目錄、
mkdir -p /data/{3306,3307}/data
十三、創建3306和3307的my.cnf文件
vi /data/3306/my.cnf
#############3306##############
#3307的話這里就不寫了就是把3306替換成3307,server-id = 1換成server-id = 3就行了;
[client]
port ? ? ? ? ? ?=3306
socket ? ? ? ? ?=/data/3306/mysql.sock
[mysql]
no-auto-rehash
[mysqld]
user ? ?= mysql
port ? ?= 3306
socket ?= /data/3306/mysql.sock
basedir = /application/mysql
datadir = /data/3306/data
open_files_limit ? ? ? ? ? ? ? ?=1024
back_log = 600
max_connections = 800
max_connect_errors = 3000
table_cache = 614
max_allowed_packet =8M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 100M
thread_concurrency = 2
query_cache_size = 2M
query_cache_limit = 1M
query_cache_min_res_unit = 2k
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 2M
max_heap_table_size = 2M
long_query_time =1
log-error = /data/3306/error.log
log-slow-queries = /data/3306/slow.log
pid-file = /data/3306/mysql.pid
#log-bin = /data/3306/mysql.bin
relay-log = /data/3306/relay-bin
relay-log-info-file = /data/3306/relay-log.info
binlog_cache_size = 1M
max_binlog_cache_size = 1M
max_binlog_size = 2M
expire_logs_days = 7
key_buffer_size = 16M
read_buffer_size = 1M
bulk_insert_buffer_size = 1M
myisam_sort_buffer_size = 1M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
skip-name-resolve
slave-skip-errors = 1032,1062
replicate-ignore-db=mysql
server-id = 1
innodb_additional_mem_pool_size = 4M
innodb_buffer_pool_size = 32M
innodb_data_file_path = ibdatal:128M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 4M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[mysqldump]
quick
max_allowed_packet = 2M
[mysqld_safe]
log-error=/data/3306/mysql_oldboy3306.err
pid-file=/data/3306/mysqld.pid
十四、授權data目錄
chown -R mysql.mysql /data/
十五、初始化
Cd /application/mysql/scripts/
./mysql_install_db--basedir=/application/mysql --datadir=/data/3306/data --user=mysql
./mysql_install_db--basedir=/application/mysql --datadir=/data/3307/data --user=mysql
十六、啟動實例3306、3307
mysqld_safe --defaults-file=/data/3306/my.cnf 2>&1 > /dev/null &
mysqld_safe --defaults-file=/data/3307/my.cnf 2>&1 > /dev/null &
十七、檢查3306和3307端口是否啟動
netstat -lntup|grep 330
十八、為兩個實例增加帳號密碼
mysqladmin -u root -S /data/3306/mysql.sock password ‘ljx1‘
mysqladmin -u root -S /data/3307/mysql.sock password ‘ljx2‘
十九、登陸實例
mysql -uroot -pljx1 -S /data/3306/mysql.sock
mysql -uroot -pljx1 -S /data/3306/mysql.sock
mysql-5.5.32多實例配置
標簽:mysql-5.5.32多實例
本條技術文章來源于互聯網,如果無意侵犯您的權益請點擊此處反饋版權投訴
本文系統來源:http://haoljx.blog.51cto.com/4402148/1775158
總結
以上是生活随笔為你收集整理的mysql5.5多实例配置_mysql-5.5.32多实例配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql varchar int_My
- 下一篇: mysql服务实例配置_MySQL多实例