国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

MYSQL數(shù)據(jù)庫多實例配置流程詳解

2024-07-24 12:35:24
字體:
供稿:網(wǎng)友
  多實例是一個比較有單的東西了,小編今天來為各位介紹mysql單多實例的配置方法,希望下文可以幫助到各位朋友.
 
  [root@Mysql ~]# yum install vim gcc gcc-c++ wget tree lsof ncurses-devel cmake libaio* -y #依賴庫
 
  [root@Mysql ~]# /usr/sbin/useradd mysql -s /sbin/nologin -M    #mysql用戶
 
  [root@Mysql ~]# cd /byrd/tools/
 
  [root@Mysql tools]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.37.tar.gz
 
  [root@Mysql tools]# tar zxf mysql-5.5.37.tar.gz
 
  [root@Mysql tools]# cd mysql-5.5.37/
 
  [root@Mysql mysql-5.5.37]# cmake . -DCMAKE_INSTALL_PREFIX=/byrd/server/mysql-5.5.37 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_READLINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1
 
  [root@Mysql mysql-5.5.37]# make && make install
 
  [root@Mysql mysql-5.5.37]# ln -s /byrd/server/mysql-5.5.37/ /usr/local/mysql
 
  [root@Mysql ~]# cd /usr/local/mysql/
 
  [root@Mysql ~]# mkdir -p /data/{3306,3307}/data
 
  [root@Mysql ~]# chown -R mysql.mysql /data
 
  [root@Mysql mysql-5.5.37]#  /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/3306/data/ --user=mysql
 
  [root@Mysql mysql-5.5.37]# ll /data/3306/data/
 
  total 12
 
  drwx------. 2 mysql root  4096 Jun 15 22:09 mysql
 
  drwx------. 2 mysql mysql 4096 Jun 15 22:36 performance_schema
 
  drwx------. 2 mysql root  4096 Jun 15 22:09 test
 
  [root@Mysql mysql]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/3307/data/ --user=mysql
 
  [root@Mysql mysql-5.5.37]# ll /data/3307/data/  
 
  total 12
 
  drwx------. 2 mysql root  4096 Jun 15 22:37 mysql
 
  drwx------. 2 mysql mysql 4096 Jun 15 22:37 performance_schema
 
  drwx------. 2 mysql root  4096 Jun 15 22:37 test
 
  [root@Mysql mysql-5.5.37]# cp /byrd/tools/mysql-5.5.37/support-files/my-medium.cnf /data/3307/my.cnf
 
  [root@Mysql mysql-5.5.37]# cp /byrd/tools/mysql-5.5.37/support-files/my-medium.cnf /data/3306/my.cnf
 
  [root@Mysql mysql-5.5.37]# sed -i 's#/tmp/mysql.sock#/data/3306/mysql.sock#g' /data/3306/my.cnf
 
  [root@Mysql mysql-5.5.37]# sed -i 's#3306#3307#g' /data/3307/my.cnf  
 
  [root@Mysql mysql-5.5.37]# sed -i 's#= 1#= 2#g' /data/3307/my.cnf
 
  [root@Mysql ~]# cat >>/data/3306/my.cnf <<BYRD
 
  > 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
 
  > log-error=/data/3306/mysql_3306.err
 
  > BYRD
 
  [root@Mysql ~]# cat >>/data/3307/my.cnf <<BYRD
 
  > [mysqld_safe]
 
  > pid-file = /data/3307/mysql.pid
 
  > log-bin = /data/3307/mysql-bin
 
  > relay-log = /data/3307/relay-bin
 
  > relay-log-info-file = /data/3307/relay-log.info
 
  > log-error=/data/3307/mysql_3307.err
 
  > BYRD
 
  [root@Mysql mysql]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf 2>&1 >/dev/null &  --phpfensi.com
 
  [root@Mysql mysql]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/3307/my.cnf 2>&1 >/dev/null &
 
  [root@Mysql 3307]# netstat -tunlp
 
  Active Internet connections (only servers)
 
  Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name         
 
  tcp        0      0 :::3307                     :::*                        LISTEN      8046/mysqld             
 
  tcp        0      0 :::3306                     :::*                        LISTEN      4943/mysqld          
 
  [root@Mysql 3307]#
 
  my.cnf配置文件內(nèi)容:
 
  [client]
 
  port            = 3306
 
  socket          = /data/3306/mysql.sock
 
  [mysql]
 
  no-auto-rehash
 
  [mysqld]
 
  user    = mysql
 
  port    = 3306
 
  socket  = /data/3306/mysql.sock
 
  basedir = /usr/local/mysql
 
  datadir = /data/3306/data
 
  open_files_limit    = 1024
 
  back_log = 600
 
  max_connections = 800
 
  max_connect_errors = 3000
 
  external-locking = FALSE
 
  max_allowed_packet =8M
 
  sort_buffer_size = 1M
 
  join_buffer_size = 1M
 
  thread_cache_size = 100
 
  thread_concurrency = 2
 
  query_cache_size = 2M
 
  query_cache_limit = 1M
 
  query_cache_min_res_unit = 2k
 
  thread_stack = 192K
 
  tmp_table_size = 2M
 
  max_heap_table_size = 2M
 
  long_query_time = 1
 
  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
 
  read_rnd_buffer_size = 1M
 
  bulk_insert_buffer_size = 1M
 
  lower_case_table_names = 1
 
  skip-name-resolve
 
  slave-skip-errors = 1032,1062
 
  replicate-ignore-db=mysql
 
  server-id = 1
 
  [mysqldump]
 
  quick
 
  max_allowed_packet = 2M
 
  [mysqld_safe]
 
  log-error=/data/3306/mysql_oldboy3306.err
 
  pid-file=/data/3306/mysqld.pid
 
  測試登陸:
 
  [root@Mysql 3306]# /usr/local/mysql/bin/mysql -S /data/3306/mysql.sock
 
  mysql> create database d3306;
 
  Query OK, 1 row affected (0.53 sec)
 
  mysql> show databases;
 
  +--------------------+
 
  | Database           |
 
  +--------------------+
 
  | information_schema |
 
  | d3306              |
 
  | mysql              |
 
  | performance_schema |
 
  | test               |
 
  +--------------------+
 
  5 rows in set (0.13 sec)
 
  [root@Mysql 3306]# /usr/local/mysql/bin/mysql -S /data/3306/mysql.sock
 
  mysql> show databases;
 
  +--------------------+
 
  | Database           |
 
  +--------------------+
 
  | information_schema |
 
  | mysql              |
 
  | performance_schema |
 
  | test               |
 
  +--------------------+
 
  4 rows in set (0.04 sec)。
 

(編輯:武林網(wǎng))

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 茶陵县| 黄平县| 青浦区| 土默特左旗| 深泽县| 新宁县| 双柏县| 咸宁市| 三江| 化德县| 中方县| 四川省| 长沙市| 临泽县| 友谊县| 密山市| 鹤庆县| 九江县| 香港| 永嘉县| 石景山区| 凤凰县| 天祝| 南开区| 手游| 皮山县| 泸水县| 琼结县| 贡觉县| 奉节县| 齐河县| 宝应县| 建湖县| 湖口县| 石嘴山市| 石城县| 和硕县| 内丘县| 阿拉善右旗| 清丰县| 邵阳市|