参考文档:
MySQL主从复制配置
一台MySQL服务器启动多个端口
/usr/local/mysql-bbs/bin/mysqld --basedir=/usr/local/mysql-bbs --datadir=/usr/local/mysql-bbs/data --plugin-dir=/usr/local/mysql-bbs/lib/plugin --user=mysql --log-error=/usr/local/mysql-bbs/data/product.kimiss.com.err --open-files-limit=8192 --pid-file=/usr/local/mysql-bbs/data/product.pid --socket=/tmp/mysql-bbs.sock --port=3307
/usr/local/mysql-product/bin/mysqld --basedir=/usr/local/mysql-product --datadir=/usr/local/mysql-product/data --plugin-dir=/usr/local/mysql-product/lib/plugin --user=mysql --log-error=/usr/local/mysql-product/data/product.kimiss.com.err --open-files-limit=8192 --pid-file=/usr/local/mysql-product/data/product.pid --socket=/tmp/mysql-product.sock --port=3306
/usr/local/mysql-bbs 下的目录,把mysql相关的内容都移动到这个文件中 bin 中包含/usr/bin/mysql* /usr/sbin/mysql*
drwxr-xr-x 5 root root 4096 12月 12 13:45 ./drwxr-xr-x 13 root root 4096 12月 12 11:37 ../drwxr-xr-x 2 root root 4096 12月 12 11:48 bin/drwxr-xr-x 2 root root 4096 8月 25 21:16 conf.d/lrwxrwxrwx 1 root root 27 12月 12 11:43 data -> /export/data/mysql-bbs/data/lrwxrwxrwx 1 root root 18 12月 12 11:41 include -> /usr/include/mysql/drwxr-xr-x 2 root root 4096 12月 12 11:18 lib/-rw-r--r-- 1 root root 1685 12月 12 12:08 my.cnflrwxrwxrwx 1 root root 16 12月 12 11:20 share -> /usr/share/mysql/
访问:
mysql -uroot -proot -h127.0.0.1 -P3306mysql -uroot -proot -h127.0.0.1 -P3307
my.cnf 配置文件中client port都是3306,mysqld是各自的端口
[client]port = 3306socket = /tmp/mysql-product.sock
[mysqld]bind-address = 127.0.0.1 port = 3306socket = /tmp/mysql-product.sockback_log = 50max_connections = 1000max_connect_errors = 10table_open_cache = 2048max_allowed_packet = 16M binlog_cache_size = 1Mmax_heap_table_size = 64M read_buffer_size = 2Mread_rnd_buffer_size = 16M sort_buffer_size = 8Mjoin_buffer_size = 8Mthread_cache_size = 8 thread_concurrency = 8 query_cache_size = 64M query_cache_limit = 2Mft_min_word_len = 4 default-storage-engine = MYISAMthread_stack = 192Ktransaction_isolation = REPEATABLE-READtmp_table_size = 64M slow_query_loglong_query_time = 2
#log-bin=mysql-bin#binlog_format=mixedserver-id = 1 #binlog-do-db=gaojie100##binlog-do-db=gaojie_brand##binlog-do-db=gaojie_manage##binlog-do-db=log_data##binlog-do-do=xf_statsbinlog-ignore-db=mysql
key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128Mmyisam_max_sort_file_size = 2Gmyisam_repair_threads = 1myisam_recoverinnodb_additional_mem_pool_size = 16Minnodb_buffer_pool_size = 512Minnodb_data_file_path = ibdata1:10M:autoextendinnodb_write_io_threads = 8innodb_read_io_threads = 8innodb_thread_concurrency = 16innodb_flush_log_at_trx_commit = 1innodb_log_buffer_size = 8Minnodb_log_file_size = 256Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120
[mysqldump]quickmax_allowed_packet = 16M
[mysql]no-auto-rehash
[myisamchk]key_buffer_size = 512Msort_buffer_size = 512Mread_buffer = 8Mwrite_buffer = 8M
[mysqlhotcopy]interactive-timeout
[mysqld_safe]open-files-limit = 8192
遇到的问题
141212 13:53:30 [Note] Plugin 'FEDERATED' is disabled.141212 13:53:30 InnoDB: The InnoDB memory heap is disabled141212 13:53:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins141212 13:53:30 InnoDB: Compressed tables use zlib 1.2.3.4141212 13:53:30 InnoDB: Initializing buffer pool, size = 128.0M141212 13:53:30 InnoDB: Completed initialization of buffer pool141212 13:53:30 InnoDB: highest supported file format is Barracuda.141212 13:53:30 InnoDB: Waiting for the background threads to start141212 13:53:31 InnoDB: 5.5.38 started; log sequence number 1618567141212 13:53:31 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306141212 13:53:31 [Note] - '127.0.0.1' resolves to '127.0.0.1';141212 13:53:31 [Note] Server socket created on IP: '127.0.0.1'.141212 13:53:31 [ERROR] /usr/local/mysql-product/bin/mysqld: Can't create/write to file '/usr/local/mysql-product/data/product.pid' (Errcode: 13)141212 13:53:31 [ERROR] Can't start server: can't create PID file: Permission denied
cd /usr/local/mysql-product/data
chmod 777 .
转载于:https://www.cnblogs.com/bandbandme/p/4152936.html
