1 System Conventions
Installation file download directory:/data/software
MySQL Directory Installation location:/usr/local/mysql
Database Save location:/data/mysql
Log Save location:/data/log/mysql
2 download MySQL
In the official website: http://dev.mysql.com/downloads/mysql/, select the following version of MySQL download:
Perform the following naming:
#mkdir/data/software
#cd/data/software
--Download the installation package
---Suggest: Use Thunder download on Windows, Fast (my is 1m/s), then use tool (XFTP) to upload to/data/software directory;
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
3 Unzip the package to the target location
# Mkdir/usr/local/mysql
#cd/dat/software
#pwd
Following execution:
#ls
#cd/usr/local
#pwd
# tar-xzvf/data/software/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
#ls
--Modify File name
# mv Mysql-5.7.13-linux-glibc2.5-x86_64 MySQL
#ls
4 Creating a Data Warehouse Catalog
--/data/mysql Data Warehouse Directory
# Mkdir/data
# Mkdir/data/mysql
# Mkdir/data/log
# Mkdir/data/log/mysql
#ls/data/
5 new MySQL user, group and directory
#---Create a new MSYQL group
[Email protected] local]# Cat/etc/group | grep MySQL MYSQL:X:1001: [Email protected] local]# CAT/ETC/PASSWD | grep MySQL Mysql:x:1001:1001::/root/mysql:/bin/bash |
These are the default conditions, such as none, to execute the Add command:
[[Email protected] ~] $groupadd MySQL [[email protected] ~]$ useradd-g MySQL MySQL |
Or use the following method (I can't do that so I use the above)
# useradd-r-s/sbin/nologin-g mysql mysql-d/usr/local/mysql---New MSYQL user Forbidden Login Shell
6 Change the directory belongs to the person
#cd/usr/local/mysql
#pwd
#chown-R MySQL.
#chgrp-R MySQL.
#chown-R Mysql/data/mysql
7 Configuration parameters
# bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql
Note the temporary password generated here, as shown at the end of the:yli>7ecpe; Yp
#bin/mysql_ssl_rsa_setup--datadir=/data/mysql
8 Modifying the System configuration file
#cd/usr/local/mysql/support-files
# CP MY-DEFAULT.CNF/ETC/MY.CNF
# CP Mysql.server/etc/init.d/mysql
# Vim/etc/init.d/mysql
Modify the following content:
# VIM/ETC/MY.CNF
Modify the following content:
Mainly for:
Basedir =/usr/local/mysql/
DataDir =/usr/local/mysql/data
Port = 3306
9 starting MySQL
#/etc/init.d/mysql Start
--Login
# mysql-hlocalhost-uroot-p
--If it appears:-bash:mysql:command not found
--On execution: # ln-s/usr/local/mysql/bin/mysql/usr/bin--no need to execute without appearing
--Enter the temporary password generated by step 6th
--Change Password
Mysql> set Password=password (' root ');
--Set the host address of the root account (modified to connect remotely)
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' root ';
Mysql>flush privileges;
--View Table
mysql> use MySQL;
Mysql> select Host,user from user;
--You can use the remote connection test here;
10 Adding a system path
# Vim/etc/profile
Add to:
Export Path=/usr/local/mysql/bin: $PATH
As follows:
# Source/etc/profile
11 Configuring MySQL Auto-start
# chmod 755/etc/init.d/mysql
# chkconfig--add MySQL
# chkconfig--level 345 MySQL on
The above is the Linux environment MySQL 5.7.13 installation tutorial, I hope that everyone's learning has helped.
Add:
--Exit the MySQL command window
#exit
--View MySQL status
#service MySQL Status
--Stop MySQL
#service MySQL Stop
--Start MySQL
#service MySQL Start
Attached MY.CNF (this is a configuration MySQL configuration file, temporarily can not tube, as you want to delve into you can Baidu or google "MySQL my.cnf configuration Details")
/etc/my.cnf
# for advice The change settings
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# * * * Don't EDIT this FILE. It ' s a template which'll be copied to the
# * * * default location during install, and would be replaced if you
# * * * * Upgrade to a newer version of MySQL.
[Mysqld]
# Remove Leading # and set to the amount of RAM for the most important data
# Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%.
Innodb_buffer_pool_size = 10G
# Remove Leading # to turn on a very important data integrity option:logging
# Changes to the binary log between backups.
Log_bin
Character-set-server=utf8
Collation-server=utf8_bin
init-connect= ' SET NAMES UTF8 '
# These is commonly set, remove the # and set as required.
Basedir =/usr/local/mysql
DataDir =/export/mysql/var
Port = 3306
server_id = 22206
Socket =/export/mysql/mysql.sock
Binlog_format = statement
# Remove Leading # To set options mainly useful for reporting servers.
# The server defaults is faster for transactions and fast selects.
# Adjust sizes as needed, experiment to find the optimal values.
Join_buffer_size = 128M
Sort_buffer_size = 2M
Read_rnd_buffer_size = 2M
Log_bin_trust_function_creators = On
Sql_mode=no_engine_substitution,strict_trans_tables
Lower_case_table_names=1
Document reference: Http://www.cnblogs.com/zhao1949/p/5947938.html
Linux CENTOS7 installation mysql-5.7.17 tutorial (illustration)