CentOS7 installation and configuration MySQL 5.6.19-remote login supported
Download and decompress
Go to the official website to download the mysql 5.6 for linux installation package. Decompress the package as follows:
Ii. Start Installation
Open the terminal and enter the decompressed directory.
$cd
MySQL-5.6.16-1.linux_glibc2.5.i386.rpm-bundle
Run(Root permission required)
# rpm -ivh MySQL-*
Where,
v
Displays detailed installation information,
h
Display
#
Indicates the installation progress.
Note: a conflict may be prompted. As follows:
I need to uninstall the conflicting Software Package first
# rpm -e --nodeps mariadb-libs-1:5.5.37-1.el7_0.x86_64
Note: carefully observe the installation process, which contains a lot of useful information, such:
The latest version of MySQL will generate a random root user password and store it in the/root/. mysql_secret file.For example:
The configuration file generated by the new MySQL version is/usr/my. cnf.This is different from the previous(Probably system-related)
After the installation is complete, you can use
netstat
View
mysql
Whether the port is enabled (default
3306
)
Medium,
tcp 0 0 :::3306 :::* LISTEN
Indicates that the port is enabled.
Iii. installation location
When RPM is used for installation, the sub-directories in MySQL are scattered and placed in the following directories:
/Etc/logrotate. d/mysql
/Etc/rc. d/init. d/mysql//MysqlStart the configuration script.MysqlAndMysqlRelated
/Var/lib/mysql// MysqlDatabase storage directory in
/Var/lock/subsys/mysql
/Usr/lib/mysql folder//This folder contains the mysql Linked Library.
/Usr/include/mysql folder//Mysql header file
/Usr/share/mysql folder//Mysql installation directory
Under the/usr/bin folder// Multiple executable programs of mysql, such as mysql, mysql_config_editor, mysqlcheck, and mysqladmin
4. boot
Run the following command:Sbin/chkconfig -- list,View startup items
Run the following command:Sbin/chkconfig -- add mysql,Add mysql to the startup Item:
Run the following command:Sbin/chkconfig -- del mysql,Delete mysql from startup:
Enable remote connection in linux
1. First, ensure that the firewall does not block port 3306
(1)#Gedit/etc/sysconfig/iptables
(2) Add the port 3306 allowed:
#-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-d port 3306-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT(Note: before-a input-j REJECT -- reject-with icmp-host-prohibited, otherwise it may not work)
(3) restart the Firewall:Service iptables restart
Ii. Configure my. cnf
Open the terminal and enterMysql--helpYou can see the following information in the help section:
It can be seen that MySQL will start from the corresponding location (/etc/my. cnf or/etc/mysql/my. cnf or/usr/etc/my. cnf or ~ /. My. cnf) read the configuration file. (Note: The latest MySQL I installed uses/usr/my. cnf.)
Mysql has a local binding.
Red Hat system, edit/etc/my. cnf(Or other locations)
Ubnutu system, Edit/Ect/mysql/my. cnf
PS: there is a difference between red Hat and my. cnf in ubnutu.
If it does not exist/Usr/lib/mysqlDirectory, the copy extension is. CnfTo the directory above, rename itMy. cnf
SearchSkip-networking, Comment it out;Bind-address = 127.0.0.1Comment out
3. Grant Permissions
In Mysql, there is a database named mysql, which contains many tables and stores system and user information.