--linux Base configuration specifies that the machine name is SQL1
--View the CentOS kernel
Uname-a
Cat/etc/issue
--Modify Machine name
1, echo "192.168.33.190 sql1 localhost.localdomain localhost4 localhost4.localdomain4" >>/etc/hosts
2, Vi/etc/sysconfig/network
Networking=yes
Hostname=sql1
--Modify IP
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth0"
bootproto= "Static"
Hwaddr= "00:0c:29:39:e0:20"
Nm_controlled= "Yes"
onboot= "Yes"
Type= "Ethernet"
Uuid= "78BFD5EF-0BA2-4FFF-ABA3-BF8D7839FCB9"
Ipaddr= "192.168.33.190"
Gateway= "192.168.33.1"
dns1=180.76.76.76
--Close SELinux
Vi/etc/sysconfig/selinux
Selinux=disabled
--Shut down the firewall
Service Iptables Stop
Chkconfig iptables off
--Configure local Yum source offload Umount/mnt/cdrom
Mkdir/mnt/cdrom
Mount/dev/cdrom/mnt/cdrom
Cd/etc/yum.repos.d
All files under it are renamed; New Centos-media.repo
VI Centos-media.repo
[C6-media]
name=centos-$releasever-media
baseurl=file:///mnt/cdrom/
Gpgcheck=1
Enabled=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Yum Clean All--cleanup yum cache
Yum Install php--Installing PHP test
If you need to change the Yum source to a network, restore the four files in the/ETC/YUM.REPOS.D directory
--See if you have installed
Rpm-qa | grep MySQL
Mysql-libs-5.1.61-4.el6.x86_64
--Uninstall MySQL
RPM-E mysql-libs--Direct Delete will fail
RPM--NODEPS-E Mysql-libs
--Compile and install the required packages
Yum-y Install make
Yum-y Install gcc-c++
Yum-y Install CMake
Yum-y Install Bison-devel
Yum-y Install Ncurses-devel
--Create MySQL users and groups
Groupadd MySQL
useradd-g MySQL MySQL
--Set the user's operating system resource limits
Vi/etc/security/limits.conf
mysqlsoftnproc2047
MySQL Hard Nproc 16384
mysqlsoftnofile1024
MySQL Hard nofile 65536
--Installation of pre-MySQL planning planning
MySQL Software Installation path-dcmake_install_prefix=/usr/local/mysql
Data File-dmysql_datadir=/data/sql1
MY.CNF configuration file-dsysconfdir=/etc/mysql
Character Set-DDEFAULT_CHARSET=UTF8MB4
Sort Rule-ddefault_collation=utf8mb4_general_ci
Open load-denabled_local_infile=1
Open Partition-dwith_partition_storage_engine=1
Open Performance_schema Library-dwith_perfschema_storage_engine=1
MySQL Port-dmysql_tcp_port=3306
--Source Code decompression
TAR-XVF mysql-5.6.21.tar.gz
CD mysql-5.6.21
CMake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/data/sql1/data \
-dsysconfdir=/etc/mysql \
-dwith_innobase_storage_engine=1 \
-dmysql_unix_addr=/var/lib/mysql/mysql.sock \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dwith_partition_storage_engine=1 \
-dextra_charsets=all \
-DDEFAULT_CHARSET=UTF8MB4 \
-ddefault_collation=utf8mb4_general_ci
Make && make install--approx. 10 minutes or so
--Set environment variable mysql command directory-dcmake_install_prefix/bin
Su-mysql
Vi/home/mysql/.bash_profile
Export Path=/usr/local/mysql/bin: $PATH
SOURCE ~/.bash_profile
--binlog path/backup Path/Temp file path InnoDB does not create directory, pre-create server before starting
Mkdir/etc/mysql
Mkdir-p/data/sql1/data
Mkdir/data/sql1/backup
Mkdir/data/sql1/tmp
Mkdir/data/sql1/binlog
Mkdir/data/sql1/log
Chown-r Mysql:mysql/data
Chown-r Mysql:mysql/usr/local/mysql
Chown-r Mysql:mysql/etc/mysql
--Configure Startup parameters
Su-mysql
Vi/etc/mysql/my.cnf
[Client]
Port = 3306
Socket =/data/sql1/data/mysql.sock
[Mysqld]
Port = 3306
user = MySQL
Socket =/data/sql1/data/mysql.sock #client and server in same machine, use localhost connect to server
Pid-file =/data/sql1/data/mysql.pid #In multi-instance Keep Each instance does not startup twice.
Basedir =/usr/local/mysql
DataDir =/data/sql1/data
Tmpdir =/data/sql1/tmp
Open_files_limit = 10240
#buffer
Max_heap_table_size = 256M
Innodb_buffer_pool_size = 128M
Sort_buffer_size = 2M
Join_buffer_size = 4M
Read_buffer_size =2m
Read_rnd_buffer_size =2m
Max_connections = 5000
#log
Log-bin =/data/sql1/binlog/mysql-bin
Max_binlog_cache_size = 512M
Max_binlog_size = 512M
Binlog_format = Mixed
Log_output = FILE
Log-error =/data/sql1/log/mysql-error.log
Slow_query_log = 1
Slow_query_log_file =/data/sql1/log/slow_query.log
General_log = 0
General_log_file =/data/sql1/log/general_query.log
Expire-logs-days = 14
#Innodb
Innodb_data_file_path = Ibdata1:128m:autoextend
Innodb_log_file_size = 256M
Innodb_log_files_in_group = 3
Innodb_log_group_home_dir =/data/sql1/log
Innodb_buffer_pool_size = 512M
innodb_file_per_table = 1
Explicit_defaults_for_timestamp=true
--Create DATABASE-dcmake_install_prefix install error view Log Mysql-error.log
Su-mysql
/usr/local/mysql/scripts/mysql_install_db--datadir=/data/sql1/data--basedir=/usr/local/mysql
--Manually start MySQL
Su-mysql
mkdir scripts
vi/home/mysql/scripts/mysql_startup.sh
#! /bin/bash
/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/ETC/MYSQL/MY.CNF &
--Close MySQL
Mysqladmin-u root-p shutdown
--sudo Add Execute Permissions close Requiretty
chmod 740/etc/sudoers
Vi/etc/sudoers
#Defaults Requiretty
chmod 440/etc/sudoers
--Restart Auto start
Vi/etc/rc.local
Sudo-i-U mysql/home/mysql/scripts/mysql_startup.sh >/tmp/mysql_db_startup.log 2>&1
MySQL 5.6 Single Instance source code compilation installation Configuration