Operating system version:
[Email protected] ~]# cat/etc/redhat-release
CentOS Release 6.5 (Final)
Operating system kernel:
[Email protected] ~]# uname-r
2.6.32-431.el6.x86_64
Turn off the firewall and turn off self-booting:
[[email protected] ~]#/etc/init.d/iptables stop
[Email protected] ~]# chkconfig--level 2345 iptables off
Temporarily disabling SELinux and modifying the configuration file Restart system is also disabled:
[Email protected] ~]# Setenforce 0
[Email protected] ~]# Vim/etc/sysconfig/selinux
Selinux=disabled
Create the directory and upload the MySQL binary package to this directory:
[Email protected] ~]# mkdir-p/home/tools
To switch to the directory, unzip the binary package:
[Email protected] ~]# cd/home/tools/
[Email protected] tools]# tar zxf mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
To create a soft link to unpack the package, the purpose of creating a soft connection is primarily to facilitate later upgrades:
[Email protected] tools]# ln-s/home/tools/mysql-5.7.14-linux-glibc2.5-x86_64/usr/local/mysql
Create a new user group and User:
[[email protected] local]# Groupadd MySQL
[Email protected] local]# useradd-m-G mysql-s/sbin/nologin-d/usr/local/mysql/mysql
Create MySQL data, logs, temporary directories, and modify the owner and owning group:
[Email protected] local]# mkdir-p/data/mysql/mysql3306/data/data/mysql/mysql3306/log/data/mysql/mysql3306/tmp
[Email protected] local]# chown-r mysql:mysql/data/mysql/mysql3306/
Modify the/etc/my.cnf file, using the default my.cnf can also be initialized successfully, but some files will be a bit messy location, here according to personal habits modified as follows:
[Email protected] tools]# VIM/ETC/MY.CNF
[Client]
Port = 3306
Socket =/tmp/mysql.sock
[MySQL]
prompt= "\\[email protected]\\h [\\d]>"
#pager = "Less-i-n-s"
#tee =/opt/mysql/query.log
No-auto-rehash
[Mysqld_multi]
Mysqld =/usr/local/mysql/bin/mysqld_safe
Mysqladmin =/usr/local/mysql/bin/mysqladmin
Log =/opt/mysql/mysqld_multi.log
[Mysqld]
#misc
user = MySQL
Basedir =/usr/local/mysql
DataDir =/data/mysql/mysql3306/data
Port = 3306
Socket =/tmp/mysql.sock
Event_scheduler = 0
Tmpdir =/data/mysql/mysql3306/tmp
#timeout
Interactive_timeout = 300
Wait_timeout = 300
#character Set
Character-set-server = UTF8
Open_files_limit = 65535
max_connections = 100
Max_connect_errors = 100000
#lower_case_table_names =1
#logs
Log-output=file
Slow_query_log = 1
Slow_query_log_file = Slow.log
Log-error = Error.log
Log_warnings = 2
Pid-file = Mysql.pid
Long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
Log-slow-slave-statements = 1
#binlog
#binlog_format = STATEMENT
Binlog_format = row
Server-id = 23306
Log-bin =/data/mysql/mysql3306/logs/mysql-bin
Binlog_cache_size = 4M
Max_binlog_size = 256M
Max_binlog_cache_size = 1M
Sync_binlog = 0
Expire_logs_days = 10
#procedure
Log_bin_trust_function_creators=1
#
Gtid-mode = 0
#relay Log
Skip_slave_start = 1
Max_relay_log_size = 128M
Relay_log_purge = 1
Relay_log_recovery = 1
Relay-log=relay-bin
Relay-log-index=relay-bin.index
Log_slave_updates
#slave-skip-errors=1032,1053,1062
#skip-grant-tables
#buffers & Cache
Table_open_cache = 2048
Table_definition_cache = 2048
Table_open_cache = 2048
Max_heap_table_size = 96M
Sort_buffer_size = 128K
Join_buffer_size = 128K
Thread_cache_size = 200
Query_cache_size = 0
Query_cache_type = 0
Query_cache_limit = 256K
Query_cache_min_res_unit = 512
Thread_stack = 192K
Tmp_table_size = 96M
Key_buffer_size = 8M
Read_buffer_size = 2M
Read_rnd_buffer_size = 16M
Bulk_insert_buffer_size = 32M
#myisam
Myisam_sort_buffer_size = 128M
Myisam_max_sort_file_size = 10G
Myisam_repair_threads = 1
#innodb
Innodb_buffer_pool_size = 100M
Innodb_buffer_pool_instances = 1
Innodb_data_file_path = Ibdata1:100m:autoextend
Innodb_flush_log_at_trx_commit = 2
Innodb_log_buffer_size = 8M
Innodb_log_file_size = 100M
Innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
Innodb_rollback_on_timeout
Innodb_status_file = 1
innodb_io_capacity = 2000
Transaction_isolation = read-committed
Innodb_flush_method = O_direct
Database initialization, default is password, can also specify parameter--initialize-insecure no password required
[Email protected] data]# cd/usr/local/mysql/bin/
[Email protected] bin]#/mysqld--initialize--user=mysql
View Password:
[Email protected] data]# cat/data/mysql/mysql3306/data/error.log |grep Password
2016-11-17t13:29:25.055578z 1 [Note] A temporary password is generated for [email protected]: XGQTE9CB+RLC
Copy the startup script and rename it to MySQL:
[Email protected] init.d]# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
Start the MySQL service and join the self-boot:
[[email protected] init.d]#/etc/init.d/mysql start
[[email protected] ~]# chkconfig--add MySQL
Execute the command to add the environment variable:
Echo ' Export path= $PATH:/usr/local/mysql/bin/' >>/etc/profile
[Email protected] init.d]# Source/etc/profile
[Email protected] init.d]# mysql-s/tmp/mysql.sock-p
Enter Password:--Write the password you see above
To modify a user password now:
unknown) @localhost [(none)]>alter user User () identified by ' 147258 ';
View database account, 5.7 User table account is more secure, do not need to secure account security, that is, do not need to delete useless account
[Email protected] [(None)]>select user,host from Mysql.user;
+-----------+-----------+
| user | Host |
+-----------+-----------+
| Mysql.sys | localhost |
| Root | localhost |
+-----------+-----------+
This article is from the "10979687" blog, please be sure to keep this source http://10989687.blog.51cto.com/10979687/1873968
MySQL 5.7.142 Binary Package Installation