--1. Create a new group and user for mysql # useradd -M -s /sbin/nologin mysql --2. Install required libraries and compilers # yum install ncurses-devel openssl-devel cmake -y --3. Unzip # tar zxvf mysql-5.6.35.tar.gz # cd mysql-5.6.35 --4. Compile and install # cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DMYSQL_USER=mysql \ -DWITH_DEBUG=0 \ -DWITH_SSL=system # make # make install --5. Copy the template as a configuration file # cp support-files/my-default.cnf /etc/my.cnf --6. Set mysql permissions # chown -R mysql.mysql /usr/local/mysql/ --7. Initialize mysql database # /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql # chown -R root /usr/local/mysql/ # chown -R mysql /usr/local/mysql/data/ --8. Set MySQL to start automatically at boot # cp support-files/mysql.server /etc/init.d/mysqld # chmod +x /etc/init.d/mysqld # chkconfig mysqld on --9. Test and run mysql #service mysqld start --10. Change the mysql administrator password #/usr/local/mysql/bin/mysqladmin -u root password 'Password to be set' --11. Log in to mysql using user # /usr/local/mysql/bin/mysql -u root -p --12. Add environment variables # echo 'PATH=/usr/local/mysql/bin/:$PATH' >>/etc/profile # source /etc/profile CentOS 6.5 minimal compilation and installation of mysql 5.5.35 configuration multiple instances 1. Turn off the firewall 1234567 [root@mysql ~]# service iptables stop iptables: 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 --list iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off 2. Turn off selinux 12 [root@mysql ~]# setenforce 0 [root@mysql ~]# vim /etc/sysconfig/selinux Modify the following line; SELINUX=disabled 12 [root@mysql ~]# getenforce Permissive 3. Install mysql dependency packages and compilation tools; 1234 [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. Preparation before installation; 4.1. Installation path: 1 [root@mysql ~]# mkdir /usr/local/mysql 4.2. Database path: 1 [root@mysql ~]# mkdir /data/mysql -p 4.3. Create users and user groups 12 [root@mysql ~]# groupadd mysql [root@mysql ~]# useradd -r -g mysql -s /bin/false mysql 4.4. Grant permissions to the data storage directory 1 [root@mysql ~]# chown mysql:mysql -R /data/mysql 5. Compile and install mysql 5.5.35 1234567 [root@mysql ~]# yum install -y lrzsz root@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 multi-instance database file storage location; 12345678 [root@mysql ~]# mkdir -p /data/{3306,3307}/data [root@mysql ~]# tree /data /data |-- 3306 | `-- data `-- 3307 `--data 4 directories, 0 files 7. Modify the configuration file (my.cnf) as follows and put it in the 3306 and 3307 directories respectively; 123456789 [root@mysql 3306]# vim my.cnf [client] port = 3306 socket = /data/3306/mysql.sock [mysqld] port = 3306 socket = /data/3306/mysql.sock datadir = /data/3306 server-id = 3306 8. Initialize the database; Note: You need to specify a different data directory when initializing the database 123 [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 startup file. 12 [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. Check the port; 12345678 [root@mysql mysql]# netstat -tunlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 11621/mysqld tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1266/sshd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 11338/mysqld tcp 0 0 :::22 :::* LISTEN 1266/sshd udp 0 0 0.0.0.0:68 0.0.0.0:* 969/dhclient 10. Log in to a multi-instance database 12 [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. Close MySQL multi-instance mode 12 [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 cat /etc/my.cnf [mysqld1] datadir=/data/mysql socket=/tmp/mysql.sock user=mysql symbolic-links=0 skip-name-resolve server-id=1221 max_connections = 2000 binlog-ignore-db=mysql binlog-ignore-db=test binlog-ignore-db=information_schema binlog-ignore-db=performance_schema innodb_buffer_pool_size = 2G innodb_additional_mem_pool=16M innodb_log_file_size=256M innodb_flush_log_at_trx_commit=2 character_set_server=utf8 collation_server = utf8_general_ci replicate_ignore_db = mysql slave-skip-errors=all relay_log=/data/mysql/ [mysqld2] port=3307 server-id=1222 log-error=/tmp/mysqld2.log datadir=/data/mysql_live socket=/tmp/mysql2.sock user=mysql symbolic-links=0 skip-name-resolve character_set_server=utf8 collation_server = utf8_general_ci max-connections=500 default-storage-engine=INNODB innodb_file_per_table log-bin=mysql-bin relay-log-info-repository=TABLE master-info-repository=TABLE expire_logs_days=10 binlog_format=ROW transaction-isolation=READ-COMMITTED binlog-ignore-db=mysql binlog-ignore-db=test binlog-ignore-db=information_schema binlog-ignore-db=performance_schema slow_query_log=TRUE slow_query_log_file=/tmp/mysqld_slow_query2.log long_query_time=3 replicate_ignore_db = mysql slave-skip-errors=all [mysqld3] server-id=1223 port=3308 log-error=/tmp/mysqld3.log datadir=/data/mysql socket=/tmp/mysql3.sock user=mysql symbolic-links=0 skip-name-resolve character_set_server=utf8 collation_server = utf8_general_ci max-connections=500 default-storage-engine=INNODB innodb_file_per_table log-bin=mysql-bin relay-log-info-repository=TABLE master-info-repository=TABLE expire_logs_days=10 binlog_format=ROW transaction-isolation=READ-COMMITTED binlog-ignore-db=mysql binlog-ignore-db=test binlog-ignore-db=information_schema binlog-ignore-db=performance_schema slow_query_log=TRUE slow_query_log_file=/tmp/mysqld_slow_query3.log long_query_time=3 replicate_ignore_db = mysql slave-skip-errors=all [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/data/mysql/mysqld.pid |
<<: Detailed explanation of Docker basic network configuration
>>: Native js to achieve seamless carousel effect
Table of contents Directory Structure bin directo...
1. Environment and related software Virtual Machi...
Table of contents 1. Introduction to NFS-Ganesha ...
Table of contents Preface iframe implements sandb...
Introduction In a production environment, in orde...
Vertical table Vertical table splitting means spl...
Pessimistic Lock Pessimistic lock, considers the ...
Table of contents Forward Proxy nginx reverse pro...
Business requirements One of the projects I have ...
Many friends will report the following error when...
Use runlike to view the docker run startup parame...
Preface MySQL supports many types of tables (i.e....
Mysql5.5 dual machine hot standby Implementation ...
Problem Description Recently, when I was building...
The div element is used to provide structure and b...