In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Modify my.cnf
[mysql]
[mysqld_multi] mysqld = / usr/local/mysql/bin/mysqld_safe mysqladmin = / usr/local/mysql/bin/mysqladmin user = password =
[mysqld1] # explicit_defaults_for_timestamp=true port = 3306 skip-name-resolve server_id=1 datadir=/data/master max_connections=3000 slow-query-log=on # # enable slow query slow-query-log-file=/var/log/mysql1/mysql-slow-queries.log long_query_time=3 # # Open binary log-bin=/data/master_binlog/mysql1_bin.log log-bin-index=/data/master_binlog/binlog.index binlog-do-db=ibuy innodb_buffer_pool_size=2G # cache innodb_log_file_size = 512m innodb_log_files_in_group = 3 innodb_additional_mem_pool_size = 64m socket=/var/lib/mysql/mysql3306.sock pid-file=/data/master/mysql.pid # query_cache_size = 128m # query cache It is suitable to look up the database symbolic-links=0 sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION log-error=/var/log/mysql1/mysqld.log user=mysql with more operations.
[mysqld2] port=3307 server_id=2 explicit_defaults_for_timestamp=true skip-name-resolve datadir=/data/slave max_connections=3000 slow-query-log=on # # enable slow query slow-query-log-file=/var/log/mysql2/mysql-slow-queries.log long_query_time=3 log-bin=/data/slave_binlog/mysql_bin.log # # enable binary log-bin-index=/data/slave_binlog/binlog.index binlog-do-db=ibuy innodb_buffer_pool_size=3G # cache innodb _ log_file_size = 512m innodb_log_files_in_group = 3 innodb_additional_mem_pool_size = 64m socket=/var/lib/mysql/mysql3307.sock pid-file=/data/slave/mysql.pid # query_cache_size = 512m # query cache It is suitable to look up the database symbolic-links=0 sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION log-error=/var/log/mysql2/mysqld.log user=mysql with more operations.
[mysqld_safe] # max_allowed_packet=20480 # log-error=/var/log/mysql/mysqld.log # pid-file=/var/run/mysqld/mysqld.pid
two。 Create a data directory
Mkdir-p / data/mastermkdir-p / data/slavemkdir-p / data/master_binlogmkdir-p / data/slave_binlogmkdir / var/log/mysql1mkdir / var/log/mysql2chown mysql.mysql / data/master-Rchown mysql.mysql / data/slave-Rchmod 777 / var/log/mysql1chmod 777 / var/log/mysql2chmod 777 / var/lib/mysql3 Initialize DB/usr/local/mysql/scripts/mysql_install_db-- datadir=/data/master / usr/local/mysql/scripts/mysql_install_db-- datadir=/data/slave 4. Install the tool cp / usr/local/mysql/bin/my_print_defaults / usr/bin/cp / usr/local/mysql/bin/mysqld_multi / usr/bin5. Modify the environment variable # vim / etc/profile PATH=$PATH:/usr/local/mysql/bin export PATH
1.mysql start
Mysqld_multi start 1 launches instance 1mysqld_multi start 1-2 starts instance 1mai 2
two。 Command line login
Mysql-u your_user-p your_password-P3307-S / tmp/mysql3307.sock due to permission issues, mysqld_multi cannot control the shutdown of mysql multiple instances I wrote a shutdown script #! / bin/bash User= "" password= "" read-p "Please input mysqld ID 1-2:" ID if ["$ID" = "1"] Then # read-p "Please input mysqld port number 3306-3307:" port / usr/local/mysql/bin/mysqladmin-u$user-p$password-S / var/lib/mysql/mysql3306.sock shutdown & & echo "close mysqld master successful" Elif ["$ID" = = "2"] Then / usr/local/mysql/bin/mysqladmin-u$user-p$password-S / var/lib/mysql/mysql3307.sock shutdown & & echo "close mysqld slave successful" else Echo "Please input mysqld ID 1-2:" fi
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.