Installing mysql5.6
1. Decompression
TAR-ZXVF mysql-5.6.23.tar.gz
2, patching, download patch mysql-openssl.patch to MySQL compression package the same path
CD mysql-5.6.23
Patch-p1 <. /mysql-openssl.patch
3. Compile and install, ensure installed ncurses,ncurses-devel,gcc,gcc-c++, "development tools" group before installation, Lrzsz,cmake
Cmake-dcmake_install_prefix=/usr/local/mysql-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8 _general_ci-dwith_readline=1-dwith_ssl=bundled-dwith_zlib=system-dwith_embedded_server=1-denabled_local_infile =1
Make && make install
4. Follow-up configuration
4.1. Create MySQL group and MySQL user
Groupadd MySQL
Useradd-s/sbin/nologin-m-G MySQL MySQL
4.2. Modify the My.cnf file
# # Example MySQL config file for medium systems.
#
# This was for a system with little memory (32m-64m) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# Other programs (such as a Web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# can copy this option file to one of those
# locations. For information on these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# in the This file, you can use the all long options, which a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options would be passed to all MySQL clients
[Client]
#password = Your_password
Port = 3306
Socket =/tmp/mysql.sock
# here follows entries for some specific programs
# The MySQL server
[Mysqld]
Datadir=/usr/local/mysql/var
Port = 3306
Socket =/tmp/mysql.sock
Skip-external-locking
Key_buffer_size = 16M
Max_allowed_packet = 1M
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8M
Lower_case_table_names=1
# Don ' t listen on a TCP/IP port at all. This can is a security enhancement,
# If all processes this need to connect to mysqld run on the same host.
# All interaction with Mysqld must is made via Unix sockets or named pipes.
# Note that the using this option without enabling named Pipes on Windows
# (via the "enable-named-pipe" option) would render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# Binary logging is required for replication
Log-bin=mysql-bin
# Binary Logging format-mixed recommended
Binlog_format=mixed
# required Unique ID between 1 and 2^32-1
# defaults to 1 if master-host are not set
# but would not function as a master if omitted
Server-id = 1
#loose-innodb-trx=0
#loose-innodb-locks=0
#loose-innodb-lock-waits=0
#loose-innodb-cmp=0
#loose-innodb-cmp-per-index=0
#loose-innodb-cmp-per-index-reset=0
#loose-innodb-cmp-reset=0
#loose-innodb-cmpmem=0
#loose-innodb-cmpmem-reset=0
#loose-innodb-buffer-page=0
#loose-innodb-buffer-page-lru=0
#loose-innodb-buffer-pool-stats=0
#loose-innodb-metrics=0
#loose-innodb-ft-default-stopword=0
#loose-innodb-ft-inserted=0
#loose-innodb-ft-deleted=0
#loose-innodb-ft-being-deleted=0
#loose-innodb-ft-config=0
#loose-innodb-ft-index-cache=0
#loose-innodb-ft-index-table=0
#loose-innodb-sys-tables=0
#loose-innodb-sys-tablestats=0
#loose-innodb-sys-indexes=0
#loose-innodb-sys-columns=0
#loose-innodb-sys-fields=0
#loose-innodb-sys-foreign=0
#loose-innodb-sys-foreign-cols=0
# Uncomment the following if you is using InnoDB tables
#innodb_data_home_dir =/usr/local/mysql/data
#innodb_data_file_path = Ibdata1:10m:autoextend
#innodb_log_group_home_dir =/usr/local/mysql/data
# you can set: _buffer_pool_size up to 50-80%
# of RAM But beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set: _log_file_size to% of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[Mysqldump]
Quick
Max_allowed_packet = 16M
[MySQL]
No-auto-rehash
# Remove The next comment character if you is not a familiar with SQL
#safe-updates
[Myisamchk]
Key_buffer_size = 20M
Sort_buffer_size = 20M
Read_buffer = 2M
Write_buffer = 2M
[Mysqlhotcopy]
Interactive-timeout
"LocalHost" #sed-i ' s: #innodb: Innodb:g '/etc/my.cnf
Sed-i ' S:/usr/local/mysql/data:/usr/local/mysql/var:g '/etc/my.cnf
4.3. Initialize the database
/usr/local/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/usr/local/mysql--datadir=/usr/ Local/mysql/var--user=mysql
Chown-r Mysql/usr/local/mysql/var
Chgrp-r mysql/usr/local/mysql/.
CP Support-files/mysql.server/etc/init.d/mysql
chmod 755/etc/init.d/mysql
Cat >/etc/ld.so.conf.d/mysql.conf<<eof
/usr/local/mysql/lib
/usr/local/lib
Eof
4.4 Shortcuts, soft connections
Ln-sf/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-sf/usr/local/mysql/include/mysql/usr/include/mysql
5. Security Settings
5.1. Start MySQL
/etc/init.d/mysql start
Ln-sf/usr/local/mysql/bin/mysql/usr/bin/mysql
Ln-sf/usr/local/mysql/bin/mysqldump/usr/bin/mysqldump
Ln-sf/usr/local/mysql/bin/myisamchk/usr/bin/myisamchk
Ln-sf/usr/local/mysql/bin/mysqld_safe/usr/bin/mysqld_safe
5.2. Set the MySQL root password
/usr/local/mysql/bin/mysqladmin-u Root Password 123456
5.3. Create a check MySQL security script
Touch Mysql_sec_script.txt
Vim Mysql_sec_script.txt
Enter the following text
Use MySQL;
Update user set Password=password (' 123456 ') where user= ' root ';
Delete from user where not (user= ' root ');
Delete from user where user= ' root ' and password= ';
drop database test;
DROP USER ' @ '% ';
Flush privileges;
/usr/local/mysql/bin/mysql-u root-p123456-h localhost < mysql_sec_script.txt
Rm-f Mysql_sec_script.txt
Echo-e "\nexpire_logs_days = ten" >>/etc/my.cnf
Sed-i '/skip-external-locking/a\max_connections = "/etc/my.cnf
6. mysql Add-on
6.1. Start, restart, stop
Start MySQL
/etc/init.d/mysql start
Restart MySQL
/etc/init.d/mysql restart
Stop MySQL
/etc/init.d/mysql stop
6.2. Boot start
Vim/etc/rc.local
Add the following line at the end
/etc/init.d/mysql start
7.mysql Remote Connection
mysql-uroot-p123456
>use MySQL;
>grant all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;
>flush privileges;
>update User Set Password=password ("123456") where user= ' root '; #1045错误
>quit
Service MySQL Restart
The default for MySQL under 8.LINUX is to distinguish the case of table names.
The way that MySQL does not differentiate between table name capitalization is actually simple:
1. Log in with root, modify/ETC/MY.CNF
2. Add a line under [mysqld]: Lower_case_table_names=1
3. Restart the database to
This article is from the "on-load" blog, make sure to keep this source http://paxpeng.blog.51cto.com/4396540/1886604
MySQL compilation installation