In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
CentOS 6.5 minimize compilation install mysql 5.5.35 configure multiple instances
1. Turn off the firewall
[root@mysql ~] # service iptables stopiptables: Setting chains to policy ACCEPT: filter [OK] iptables: Flushing firewall rules: [OK] iptables: Unloading modules: [OK] [root@mysql ~] # chkconfig iptables off [root@mysql ~] # chkconfig iptables-listiptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
2. Close selinux
[root@mysql ~] # setenforce 0 [root@mysql ~] # vim / etc/sysconfig/selinux
Modify the following line
SELINUX=disabled
[root@mysql ~] # getenforce Permissive
3. Install mysql dependency packages and compilation tools
[root@mysql ~] # yum install libaio-devel-y [root@mysql ~] # yum install-y ncurses-devel [root@mysql] # yum install-y gcc gcc-c++ [root@mysql ~] # yum install-y cmake
4. Prepare before installation
4.1. Installation path:
[root@mysql ~] # mkdir / usr/local/mysql
4.2. Database path:
[root@mysql ~] # mkdir / data/mysql-p
4.3. Create users and user groups
[root@mysql ~] # groupadd mysql [root@mysql ~] # useradd-r-g mysql-s / bin/false mysql
4.4. Give permission to the data storage directory
[root@mysql] # chown mysql:mysql-R / data/mysql
5. Compile and install mysql 5.5.35
[root@mysql] # yum install-y lrzszroot@mysql ~] # mkdir / package [root@mysql ~] # cd / package/ [root@mysql package] # tar xf mysql-5.5.32.tar.gz [root@mysql package] # cd mysql-5.5.32 [root@mysql mysql-5.5.32] # cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_READLINE=1-DENABLED_LOCAL_INFILE=1-DMYSQL_DATADIR=/data/mysql/-DMYSQL_USER=mysql-DMYSQL_TCP_PORT= 3306 [root @ mysql mysql-5.5.32] # make & & make install
6. Create a location for storing multi-instance database files
[root@mysql ~] # mkdir-p / data/ {3306 data/ 3307} / data [root@mysql ~] # tree / data/data |-- 3306 | `--data`-- 3307`-- data4 directories, 0 files
7. Modify the configuration file (my.cnf), such as the following line, and put it in the 3306 and 3307 directories respectively.
[root@mysql 3306] # vim my.cnf [client] port = 3306socket = / data/3306/ mysql.sock [mysqld] port = 3306socket = / data/3306/mysql.sockdatadir = / data/3306server-id = 3306
8. Initialize the database
Note: different data directories need to be specified when initializing the database
[root@mysql mysql-5.5.32] # cd / usr/local/mysql/ [root@mysql mysql] # scripts/mysql_install_db-user=mysql-basedir=/usr/local/mysql-datadir=/data/3306 [root@mysql mysql] # scripts/mysql_install_db-user=mysql-basedir=/usr/local/mysql-datadir=/data/3307
9. Start multiple instances, and the startup script can be added to the boot file.
[root@mysql mysql] # / usr/local/mysql/bin/mysqld_safe-- defaults-file=/data/3306/my.cnf 2 > & 1 > / dev/null & [root@mysql mysql] # / usr/local/mysql/bin/mysqld_safe-- defaults-file=/data/3307/my.cnf 2 > & 1 > / dev/null &
9.1. View the port
[root@mysql mysql] # netstat-tunlpActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0 tunlpActive Internet connections 3307 0.0.0.015 * LISTEN 11621/mysqld tcp 0 0 0.0.0.015 0.0.0.0 * LISTEN 1266/sshd tcp 0 00.0.0.0 3306 0.0.0.0 0 0: 22:: * LISTEN 1266/sshd udp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 8. 0. 0. 0. 0. 0. 0. 0. 0
10. Log in to multi-instance database
[root@mysql mysql] # / usr/local/mysql/bin/mysql-u root-p-P 3306-S / data/3306/mysql.sock [root@mysql mysql] # / usr/local/mysql/bin/mysql-u root-p-P 3307-S / data/3307/mysql.sock
11. Disable mysql multi-instance mode
[root@mysql mysql] # / usr/local/mysql/bin/mysqladmin-u root-p-P 3306-S / data/3306/mysql.sock shutdown [root@mysql mysql] # / usr/local/mysql/bin/mysqladmin-u root-p-P 3307-S / data/3307/mysql.sock shutdown
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.