MySQL Binary package Installation:
- How to get the installation package
Official website Download url:http://dev.mysql.com/downloads/mysql/
Database Download url:http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.22-linuxglibc2.5-x86_64.tar.gz
Sohu Download mirror:http://mirrors.sohu.com/mysql/mysql-5.6/mysql-5.6.22-linux-glibc2.5x86_64.tar.gz
- Database planning
Installation Scenarios |
Operating system |
Red Hat Enterprise Linux Server Release 6.8 (Santiago) |
Database version |
Mysql-5.6.22-linux-glibc2.5-x86_64
|
IP Address |
192.168.1.100/24
|
Database installation directory |
/usr/local/mysql |
Database Data File directory |
/data/mysql/mytest_3306 |
- Installation steps
[[email protected] ~]# getenforceEnforcing[[email protected] ~]# setenforce 0 >临时关闭,永久关闭可修改配置文件[[email protected] ~]# getenforcePermissive[[email protected] ~]# cat /etc/selinux/config | grep -v ^# | grep -v ^$SELINUX=disabledSELINUXTYPE=targeted [[email protected] ~]# /etc/init.d/iptables stop[[email protected] ~]# chkconfig iptables off
# mkdir -p /opt/{software,mysql}# tree /opt/├── mysql└── software
- Upload MySQL installation package
- Unzip the MySQL installation package
[[email protected] software]# lsmysql-5.6.39-linux-glibc2.12-x86_64.tar.gz[[email protected] software]# tar -zxf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz[[email protected] software]# lsmysql-5.6.39-linux-glibc2.12-x86_64 mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz[[email protected] software]# mv mysql-5.6.22-linux-glibc2.5-x86_64 /opt/mysql/mysql5.6[[email protected] software]# cd ..[[email protected] opt]# cd mysql/[[email protected] mysql]# lsmysql5.6
[[email protected] software]# cd /usr/local/[[email protected] local]# ln -s /opt/mysql/mysql5.6 mysql[[email protected] local]# ls -l mysqllrwxrwxrwx. 1 root root 19 Jan 13 19:51 mysql -> /opt/mysql/mysql5.6
[[email protected] data]# mkdir -p /data/mysql/mytest_3306[[email protected] data]# tree /data/data└── mysql └── mytest_3306[[email protected] home]# groupadd mysql > 创建mysql组[[email protected] home]# useradd mysql -g mysql -d /data/mysql/mytest_3306 -s /dev/null >新建的 mysql 用户,属组mysql ,homedir 是 /data/mysql/mytest_3306,登录shell为空
- Creating a configuration file
/ETC/MY.CNF for MySQL database configuration file
#my. Cnf[client]port = 3306socket =/tmp/mysql.sock[mysql]prompt= "\\[email protected]\\h:\p \\r:\\m:\\s [\\d] > "#tee =/data/mysql/mysql_3306/data/query.logno-auto-rehash[mysqld_multi]mysqld =/usr/local/mysql/bin/mysqld_ Safemysqladmin =/usr/local/mysql/bin/mysqladminlog =/opt/mysql/mysqld_multi.log[mysqld] #miscuser = Mysqlbasedir =/ Usr/local/mysqldatadir =/data/mysql/mytest_3306port = 3306socket =/tmp/mysql.sockevent_scheduler = 0# Timeoutinteractive_timeout = 300wait_timeout = 300#character Setcharacter-set-server = Utf8open_files_limit = 65535max_ Connections = 100max_connect_errors = 100000skip-name-resolve = 1#logslog-output=fileslow_query_log = 1slow_query_log_ File = Slow.loglog-error = Error.loglog_warnings = 2pid-file = Mysql.pidlong_query_time = 1#log-slow-admin-statements = # log-queries-not-using-indexes = 1log-slow-slave-statements = 1#binlogbinlog_format = Mixedserver-id = 203306log-bin = Mybinlogbinlog_cache_size = 4mmax_binlog_size = 1gmax_binlog_cache_size = 2GsyNc_binlog = 0expire_logs_days = 10#relay Logskip_slave_start = 1max_relay_log_size = 1grelay_log_purge = 1relay_log_recov ery = 1log_slave_updates#slave-skip-errors=1032,1053,1062explicit_defaults_for_timestamp=1#buffers & Cachetable_open_cache = 2048table_definition_cache = 2048table_open_cache = 2048max_heap_table_size = 96Msort_buffer_ Size = 2mjoin_buffer_size = 2mthread_cache_size = 256query_cache_size = 0query_cache_type = 0query_cache_limit = 256Kquery _cache_min_res_unit = 512thread_stack = 192ktmp_table_size = 96mkey_buffer_size = 8mread_buffer_size = 2Mread_rnd_buffer _size = 16mbulk_insert_buffer_size = 32m#myisammyisam_sort_buffer_size = 128mmyisam_max_sort_file_size = 10Gmyisam_ Repair_threads = 1#innodbinnodb_buffer_pool_size = 100minnodb_buffer_pool_instances = 1innodb_data_file_path = Ibdata1 : 1g:autoextendinnodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 64minnodb_log_file_size = 500Minnodb_log_ Files_in_group = 3innodb_max_dirty_pages_pct = 50innodb_file_per_tabLe = 1innodb_rollback_on_timeoutinnodb_status_file = 1innodb_io_capacity = 2000transaction_isolation = Read-committedinnodb_flush_method = instance of o_direct# port number 3306 special configuration [Mysqld3306]port =3306 server-id=203306# Specify the corresponding version of Basedir and datadirbasedir=/usr/local/mysqldatadir =/data/mysql/mysql_3306/datasocket =/tmp/mysql_3306 for this instance. sock# reconfigure these options, not the same as the global configuration, will directly overwrite the above global settings innodb_buffer_pool_size = 100m#transaction_isolation = repeatable-read[ mysqld3308]port=3308server-id=203308#binlog-do-db=db01basedir=/usr/local/mysqldatadir =/data/mysql/mysql_3308/ Datasocket =/tmp/mysql_3308.sock# Reconfigure these options, not the same as the global configuration, will directly overwrite the above global settings innodb_buffer_pool_size = 100minnodb_flush_log_at _trx_commit = 2sync_binlog = 0[mysqld3309]port=3309server-id=203309#binlog-do-db=db01basedir=/usr/local/ Mysqldatadir =/data/mysql/mysql_3309/datasocket =/tmp/mysql_3309.sock# Reconfigure these options, not as with the global configuration, directly overriding the global settings above innodb_ Buffer_pool_size = 100minnodb_flush_log_at_trx_commit = 2sync_binlog = 0
- initializing MySQL database datadir
[[email protected] home]# chown-r mysql.mysql/data/mysql/mytest_3306 > modified genera Group [[Email protecte D] home]# cd/usr/local/mysql/[[email protected] mysql]# chown-r mysql.mysql/usr/local/mysql/*[[email Protected] mysql]#./scripts/mysql_install_db--user=mysql--datadir=/data/mysql/mytest_3306installing MySQL System Tables ... Okfilling Help Tables ... OKto start mysqld at boot time has to copysupport-files/mysql.server to the right place for your systemplease Remembe R to SET A PASSWORD for the MySQL root USER! To does, start the server, then issue the following commands:/usr/local/mysql/bin/mysqladmin-u root password ' New-pass Word '/usr/local/mysql/bin/mysqladmin-u root-h localhost.localdomain password ' new-password ' Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installationwhich would also give you the option of removing the testdatabases and anon Ymous user created by default. This isstrongly recommended for production servers. SEE the Manual for more instructions. You can start the MySQL daemon with:cd. ; /usr/local/mysql/bin/mysqld_safe &you can test the MySQL daemon with mysql-test-run.pl CD mysql-test; Perl mysql-test-run.plplease Report No problems at Http://bugs.mysql.com/The latest information on MySQL is available On the web at Http://www.mysql.comSupport MySQL by buying support/licenses at Http://shop.mysql.comNew Default Config fil E was created as./my.cnf Andwill is used by default if you start it. Settingswarning:default config file/etc/my.cnf exists on the systemthis file wil L be read by default by the MySQL Serverif you does not want to use this, either remove it, or use The--defaults-file Argume NT to Mysqld_safe when starting the server
- Adding environment variables
[[email protected] mysql]# echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile[[email protected] mysql]# source /etc/profile
- Start Service configuration
[[email protected] mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld[[email protected] mysql]# /etc/init.d/mysqld startStarting MySQL.......... SUCCESS!
From for notes (Wiz)
MySQL5.6 stand-alone deployment installation