Linux installation MySQL
1. mysql installation package download
Official: Https://dev.mysql.com/downloads/mysql/5.6.html#downloads
Depending on the Linux version select the corresponding install package download
2. Create the installation directory
mkdir /usr/local/mysql
Store the downloaded installation package in this directory
3. Unpack the installation package
tar -xvf mysql-5.6. 1. El6.x86_64.rpm-bundle. Tar
Unzip file details
mysql-client-5.6.36-1.el6.x86_64.rpm #MySQL客户端程序
mysql-devel-5.6.36-1.el6.x86_64.rpm #MySQL的库和头文件
mysql-embedded-5.6.36-1.el6.x86_64.rpm #MySQL的嵌入式程序
mysql-shared-compat-5.6.36-1.el6.x86_64.rpm #RHEL兼容包
mysql-shared-5.6.36-1.el6.x86_64.rpm #MySQL的共享库
mysql-server-5.6.36-1.el6.x86_64.rpm #MySQL服务端程序
mysql-test-5.6.36-1.el6.x86_64.rpm #MySQL的测试组件
4. Add MySQL group and MySQL user to the system
Add MySQL Group
Groupadd MySQL
Add a MySQL user to the MySQL group
Useradd-r-G mysql-s/bin/false MySQL
Note: Because the user is required only for ownership purposes, not login purposes, the Useradd command uses the-r and-s/b In/false options to create a user this does not has a login permissions to your server host. Omit these options if your useradd does not support them. (MySQL only as a system account, not for login)
5. mysql Directory permission owner modification
chown -R mysql:mysql./
6. Installation Preparation
See if there was a previous installation
rpm-qa| grep -I. mysql
Remove installation Information
Rpm-e Mysql-libs–nodeps
7. Install MySQL
Install in the following order
RPM-IVH mysql-client-5.6. 1-ivh mysql-devel-5.6. 1-ivh mysql-server-5.6. 1-ivh mysql-shared-5.6. 1. el6.x86_64.rpm
This may be the case when installing mysql-server-5.6.36-1.el6.x86_64.rpm because of a lack of libnuma dependencies and the need to resolve dependencies before reinstalling.
Installation dependency Mode
(1) Yum installation
Yum Install Libnuma
(2) Download the Missing correspondence package
RPM-IVH numactl-2.0. 9-2. el6.x86_64.rpm
8, the installation is complete, start the service
Service MySQL Start
9, configure the MySQL login password, and authorize the host login.
(1) Get random passwords generated when MySQL is installed
Cat /root/.mysql_secret
(2) by obtaining the password, execute the login
Mysql-uroot–p
(3) Reset root password
SET for ' Root '@'localhost'= PASSWORD ('[email protected] ');
(4) Authorized host Login
Authorize any host to log in
GRANT All Privileges on *. * to ' Root '@'%'by'[email protected]' withGRANTOPTION;
Authorize designated host to log in
GRANT All Privileges on *. * to ' Root '@'xxx.xxx.xxx.xx'by'[email protected] 'withGRANTOPTION;
Execute new Permissions Now
privileges;
(5) Exit the MySQL command line
Quit
10. Restart Service
11. Development of 3306 Ports
View firewall status
/etc/init.d/iptables status
See if 3306 ports have been developed and none open 3306 ports
3306 -j ACCEPT
Linux installation MySQL