Install MySQL on Redhat Linux
On Linux, Mysql usually has three installation methods:
Rpm Installation
General Binary Package Installation
Source code installation package
This article first introduces the RPM installation method. Here we will mainly introduce the open-source community version. First download
Http://dev.mysql.com/downloads/mysql/
You can select the installation package type for different platforms. The latest version is 5.7.11, And the RPM version also has various types. After learning about this, you can select the appropriate installation package:
Package Name |
Summary |
Mysql-community-server |
Database server and related tools |
Mysql-community-client |
MySQL client applications and tools |
Mysql-community-common |
Common files for server and client libraries |
Mysql-community-devel |
Development header files and libraries for MySQL database client applications |
Mysql-community-libs |
Shared libraries for MySQL database client applications |
Mysql-community-libs-compat |
Shared compatibility libraries for previous MySQL installations |
Mysql-community-embedded |
MySQL embedded library |
Mysql-community-embedded-devel |
Development header files and libraries for MySQL as an embeddable library |
Mysql-community-test |
Test suite for the MySQL server |
The specific name structure is as follows:
Packagename-version-distribution-arch.rpm
Not to mention version. It is actually the database version. distribution and arch indicate the LINUX type and the installation package Built on the CPU platform. The specific distribution mark is as follows:
Distribution Value |
Intended Use |
El5, el6, el7 |
Red Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7 |
Fc22, fc23 |
Fedora 22 or 23 |
Sles12 |
SUSE Linux Enterprise Server 12 |
For example: mysql-community-server-5.7.11-1.el7.x86_64.rpm, is RedHat Enterprise Linux 7/Oracle Linux 7 (x86, 64-bit), On the RPMPackage
MySQL Server Installation Package
The installation is simple:
Shell> rpm-qpl mysql-community-server-version-distribution-arch.rpm can see that RPM package installation is simple, more suitable for beginners, but need to download the appropriate installation package according to the specific needs such as server and client needs to be separately installed, see the table above;
In addition, the installation path is not flexible and the default path cannot be modified. Therefore, only one server can be installed on one server. The specific path is as follows:
Files or Resources |
Location |
Client programs and scripts |
/Usr/bin |
Mysqld server |
/Usr/sbin |
Configuration file |
/Etc/my. cnf |
Data directory |
/Var/lib/mysql |
Error log file |
For RHEL, Oracle Linux, CentOS or Fedora platforms:/var/log/mysqld. log For SLES:/var/log/mysql/mysqld. log |
Value of secure_file_priv |
/Var/lib/mysql-files |
System V init script |
For RHEL, Oracle Linux, CentOS or Fedora platforms:/etc/init. d/mysqld For SLES:/etc/init. d/mysql |
Systemd service |
For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld For SLES: mysql |
Pid file |
/Var/run/mysql/mysqld. pid |
Socket |
/Var/lib/mysql. sock |
Keyring directory |
/Var/lib/mysql-keyring |
Unix manual pages |
/Usr/share/man |
Include (header) files |
/Usr/include/mysql |
Libraries |
/Usr/lib/mysql |
Miscellaneous support files (for example, error messages, and character set files) |
/Usr/share/mysql |
After installation, MYSQL is not started automatically, but needs to be started manually:
Shell> service mysqld start
After the startup server is initialized, the super account 'root' @ localhost' is created, and the user password is stored in the error log file, use shell> grep 'temporary password'/var/log/mysqld. log can be found. log in and change the password:
Shell> mysql-uroot-pmysql> alter user 'root' @ 'localhost' identified by 'mynewpass4! ';
This completes the installation of the rpm installation package.
For more details, please continue to read the highlights on the next page:
[Content navigation] |
Page 1st: RPM Installation |
Page 2nd: binary package Installation |