First, installation environment: CentOS 7 Linux version 3.10.0-229.el7.x86_64 Nginx-1.9.12
Mysql-5.6.14
Second, installation steps
2.1 Installing MySQL-related components
Command: Yum install–y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel BZR Bison Libtoo L Ncurses5-devel
650) this.width=650; "title=" 2-GCC "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 2-GCC "src=" http:// S3.51cto.com/wyfs02/m01/7f/86/wkiom1choybrothjaaarc7qqi7i824.jpg "height="/>
2.2 Downloads mysql-5.6.14
Command: CD/USR/LOCAL/SRC
Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz/from/http:// cdn.mysql.com/-O mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
650) this.width=650; "title=" 2016-04-11 00-09-36 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 2016-04-11 00-09-36 "src=" Http://s3.51cto.com/wyfs02/M02/7F/84/wKioL1cho_Oio9DVAAAjPBFggWI431.jpg "height=" 88 "/ >
2.3 Unzip and move the MySQL folder
Command: TAR–ZXF mysql-5.6.14-linux-glibc2.5-x86_64. tar.gz
650) this.width=650; "title=" 1-tar "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 1-tar "src=" http:// S3.51cto.com/wyfs02/m00/7f/84/wkiol1cho_siumjeaaax6kussie530.jpg "height=" 123 "/>
Command: MV Mysql-5.6.14-linux-glibc2.5-x86_64. /mysql
650) this.width=650; "title=" 2-MV "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0px ;p adding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 2-mv "src=" http:// S3.51cto.com/wyfs02/m00/7f/86/wkiom1choyqrivp0aaarymdowxe497.jpg "height="/>
2.4 Create MySQL user groups and users, and database storage directory
Mkdir-p/data/mysql_data
Mkdir-p/data/mysql_log
Mkdir-p/data/log-bin
Groupadd MySQL
Useradd mysql-g mysql-m-s/sbin/nologin
Chown-r Mysql.mysql/data/mysql_data/data/mysql_log/data/log-bin
Chown-r Mysql.mysql/usr/local/mysql
650) this.width=650; "title=" 5-usrerconf "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 5- Usrerconf "src=" http://s3.51cto.com/wyfs02/M01/7F/84/wKioL1cho_fyqri9AAAZ4qoAZv4406.jpg "height=" "/>"
2.5 Configuring MySQL Files my.cnf
Command: VIM/ETC/MY.CNF
Configuration content:
[Mysqld]
# General #
user = MySQL
Default-storage-engine = InnoDB
Socket =/data/mysql_data/mysql.sock
Port = 3306
Explicit_defaults_for_timestamp=true
# MyISAM #
Key_buffer_size = 1344M
Myisam_recover = Force,backup
# SAFETY #
Max_allowed_packet = 16M
Max_connect_errors = 1000000
Skip_name_resolve
# DATA STORAGE #
DataDir =/data/mysql_data/
Long_query_time = 1
# BINARY LOGGING #
Log-bin =/data/log-bin/mysql-bin-3306
Expire-logs-days = 14
Sync-binlog = 1
Server-id = 1
Max_binlog_size = 500M
# REPLICATION #
Relay-log =/data/log-bin/relay-bin-3306
Slave-net-timeout = 60
# CACHES and LIMITS #
Tmp_table_size = 32M
Max_heap_table_size = 32M
Max_connections = 500
Thread_cache_size = 50
Open_files_limit = 65535
Table_definition_cache = 4096
Table_open_cache = 4096
# INNODB #
Innodb_data_file_path = Ibdata1:128m;ibdata2:10m:autoextend
Innodb_flush_method = O_direct
Innodb_log_files_in_group = 2
Innodb_lock_wait_timeout = 50
Innodb_log_file_size = 256M
Innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
Innodb_thread_concurrency = 8
Innodb_buffer_pool_size = 8G
# LOGGING #
Log-error =/data/mysql_log/mysql-error-3306.log
Log-queries-not-using-indexes = 1
Slow-query-log = 1
Long_query_time = 1
Slow-query-log-file =/data/mysql_log/mysql-slow-3306.log
# for SLAVE #
#binlog-format = ROW
#log-slave-updates = True
#gtid-mode = On
#enforce-gtid-consistency = True
#master-info-repository = TABLE
#relay-log-info-repository = TABLE
#sync-master-info = 1
#slave-parallel-workers = 2
#binlog-checksum = CRC32
#master-verify-checksum = 1
#slave-sql-verify-checksum = 1
#binlog-rows-query-log_events = 1
#report-port = 3306
#report-host = 192.168.41.98
[Mysqld_safe]
Pid-file=/data/mysql_data/mysql.pid
[MySQL]
Socket=/data/mysql_data/mysql.sock
[Mysqldump]
Socket=/data/mysql_data/mysql.sock
[Mysqladmin]
Socket=/data/mysql_data/mysql.sock
650) this.width=650; "title=" 6-mycnf "style=" Border-top:0px;border-right:0px;background-image:none;border-bottom : 0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 6-mycnf "src="/http S3.51cto.com/wyfs02/m01/7f/86/wkiom1choyzdxjelaaa7o2bzu9g302.jpg "height=" 233 "/>
2.6 Configure MySQL to service the system and set it to boot
Command 1:cp-af/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
Vim/etc/init.d/mysqld
Modify the following and save
Basedir=/usr/local/mysql
Datadir=/data/mysql_data
650) this.width=650; "title=" 8-mysqld "style=" Border-top:0px;border-right:0px;background-image:none;border-bottom : 0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 8-mysqld "src="/http S3.51cto.com/wyfs02/m00/7f/86/wkiom1choy2bb8dbaaaykaimrto846.jpg "height=" "/>"
Command 2:chmod 755/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--level 345 mysqld on
Chkconfig--list
650) this.width=650; "title=" 8-mysqld-1 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 8- Mysqld-1 "src=" http://s3.51cto.com/wyfs02/M01/7F/86/wKiom1choy6wWK2bAAArUZ5s53E606.jpg "height=" 103 "/>
2.7 Initializing the database
Command: Cd/usr/local/mysql
./scripts/mysql_install_db--user=mysql--DEFAULTS-FILE=/ETC/MY.CNF
650) this.width=650; "title=" 13-dataopen "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 13- Dataopen "src=" http://s3.51cto.com/wyfs02/M01/7F/84/wKioL1cho_6BjKrgAAA0XFEdzQ0883.jpg "height=" 183 "/>
2.8 Starting, shutting down, and restarting the MySQL service
Command: Service mysqld start #启动mysql服务
Service mysqld Stop #关闭mysql服务
Service mysqld Restart #重启mysql服务
650) this.width=650; "title=" 10-mysqlstart "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 10- Mysqlstart "src=" http://s3.51cto.com/wyfs02/M02/7F/84/wKioL1cho__gnv0lAAAO0ghvVTQ084.jpg "height="/>
2.9 Change root password and set login permissions
Command:
Mysql–uroot #root用户初始密码为空, simply enter this command to log in to MySQL
>set password for ' root ' @ ' localhost ' = password (' hkbfmysql '); #配置root密码为HKbfmysql
>grant all privileges on * * to ' root ' @ '% ' identified by ' hkbfmysql ' with GRANT option; #配置允许所有主机可以用root用户登陆mysql
>exit
650) this.width=650; "title=" 11-rootpwd "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 11- Rootpwd "src=" http://s3.51cto.com/wyfs02/M00/7F/84/wKioL1chpACTMQbiAABEx_Haotc246.jpg "height=" 161 "/>
650) this.width=650; "title=" 12-everaddlogin "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" 12- Everaddlogin "src=" http://s3.51cto.com/wyfs02/M02/7F/84/wKioL1chpAHxWQo9AAAb6rNXRaE890.jpg "height="/>
This article is from the "Bit Technology" blog, please be sure to keep this source http://tryrus.blog.51cto.com/10914693/1768563
CentOS 7 Installation mysql-5.6.14