Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The rpm installation method of MySQL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "rpm installation of MySQL". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the rpm installation of MySQL".

The rpm package used to install MySQL is as follows:

Table 2.6 RPM Packages for MySQL Community Edition

Package NameSummarymysql-community-serverDatabase server and related tools database server and related tools mysql-community-clientMySQL client applications and tools MySQL client applications and tools common files mysql-community-develDevelopment header files and libraries for MySQL database client applicationsmysql-community-libsShared libraries for MySQL database client applicationsmysql-community-libs-compatShared compatibility libraries for previous MySQL installationsmysql-community-embeddedMySQL embedded librarymysql-community-embedded-develDevelopment header files and libraries for MySQL for mysql-community-commonCommon files for server and client libraries server and client library As an embeddable librarymysql-community-testTest suite for the MySQL server

Table 2.7 RPM Packages for the MySQL Enterprise Edition

Package NameSummarymysql-commercial-serverDatabase server and related toolsmysql-commercial-clientMySQL client applications and toolsmysql-commercial-commonCommon files for server and client librariesmysql-commercial-develDevelopment header files and libraries for MySQL database client applicationsmysql-commercial-libsShared libraries for MySQL database client applicationsmysql-commercial-libs-compatShared compatibility libraries for previous MySQL installationsmysql-commercial-embeddedMySQL embedded librarymysql-commercial-embedded-develDevelopment header files and libraries for MySQL as an embeddable librarymysql-commercial-testTest suite for the MySQL server

The syntax format of the rpm package:

Packagename-version-distribution-arch.rpm

The distribution and arch values indicate the Linux distribution and the processor type for which the package was built. See the table below for lists of the distribution identifiers:

Table 2.8 MySQL Linux RPM Package Distribution Identifiers

Distribution ValueIntended Useel5, el6, el7Red Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7fc22, fc23Fedora 22 or 23sles12SUSE Linux Enterprise Server 12

View all files (for example, mysql-community-server) in the rpm package:

Shell > rpm-qpl mysql-community-server-version-distribution-arch.rpm

The rest of this chapter applies only to the installation of packages downloaded from Oracle, not to the installation of MySQL libraries.

There are some dependencies in the package. If you plan to install several packages, you should choose to download the rpm package group in tar format, which contains all of the above packages, so you don't have to download them separately.

In most cases, you need to install mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and and mysql-community-libs-compat to get a working, standard MySQL system. To perform such a standard, minimal installation, change to the path of the folder where the packages are located, and execute the following command in addition to the Red Hat Enterprise Linux/Oracle Linux/CentOS 5 platform:

Shell > sudo yum install mysql-community- {server,client,common,libs}-*

Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).

For the Red Hat Enterprise Linux/Oracle Linux/CentOS 5 platform, there is an additional package to install: mysql-version-el5-arch.rpm, use the following command:

Shell > sudo yum install mysql-community- {server,client,common,libs}-* mysql-5.*

Although using an advanced package management tool such as yum to install packages is an excellent choice, there are still users who prefer to install directly using rpm's command rpm-Uvh, which increases the risk of failure because of potential package dependency problems.

To install only the client programs, you can skip mysql-community-server in your list of packages to install; issue the following command for platforms other than Red Hat Enterprise Linux/Oracle Linux/CentOS 5:

Shell > sudo yum install mysql-community- {client,common,libs}-*

Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).

For Red Hat Enterprise Linux/Oracle Linux/CentOS 5 systems:

Shell > sudo yum install mysql-community- {client,common,libs}-* mysql-5.*

A standard installation of MySQL using the RPM packages result in files and resources created under the system directories, shown in the following table.

The default layout of the MySQL installation is as follows:

Table 2.9 MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone

Files or ResourcesLocationClient programs and scripts/usr/binmysqld server/usr/sbinConfiguration file/etc/my.cnfData directory/var/lib/mysqlError log fileFor RHEL, Oracle Linux, CentOS or Fedora platforms: / var/log/mysqld.log

For SLES: / var/log/mysql/mysqld.logValue of secure_file_priv/var/lib/mysql-filesSystem V init scriptFor RHEL, Oracle Linux, CentOS or Fedora platforms: / etc/init.d/mysqld

For SLES: / etc/init.d/mysqlSystemd serviceFor RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld

For SLES: mysqlPid file/var/run/mysql/mysqld.pidSocket/var/lib/mysql/mysql.sockKeyring directory/var/lib/mysql-keyringUnix manual pages/usr/share/manInclude (header) files/usr/include/mysqlLibraries/usr/lib/mysqlMiscellaneous support files (for example, error messages, and character set files) / usr/share/mysql

The installation also creates a user named mysql and a group named mysql on the operating system.

Note

Using the old installation package to install the original version of MySQL may create a configuration file called / usr/my.cnf. It is strongly recommended that you check the contents of the file and migrate the useful settings to the file / etc/my.cnf, and then remove / usr/my.cnf.

MySQL does not start automatically at the end of the installation process. For Red Hat Enterprise Linux, Oracle Linux, CentOS, and Fedora systems, start MySQL using the following command:

Shell > sudo service mysqld start

For For SLES systems, the command is the same, but the service name is different:

Shell > sudo service mysql start

If the operating system has systemd enabled, standard service commands such as stop,start,status and restart should be used to manage the services of the MySQL server. The mysqld service is enabled by default and starts with the system. Note that some things appear inconsistent on the systemd platform: for example, changing the location of the data directory can be problematic.

At the initial start up of the server, the following happens, given that the data directory of the server is empty:

During the server initialization startup phase, the following occurs, as long as the server's data directory has no data:

Server initialization.

An SSL certificate and key file is generated in the data directory.

The validate_password plugin plug-in is installed and takes effect.

A superuser account 'root'@'localhost' is created. The super user's password has been set and stored in the error log file. To find it, RHEL, Oracle Linux, CentOS, and Fedora systems, use the following command:

Shell > sudo grep 'temporary password' / var/log/mysqld.log

Use the following command for SLES systems:

Shell > sudo grep 'temporary password' / var/log/mysql/mysqld.log

The next step is to log in to the database with the temporary password you just generated and set a typical password for the superuser account:

Shell > mysql-uroot-p

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4passport'

Note

MySQL installs the validate_password plug-in by default. The plug-in requires the password to contain at least one uppercase letter, one lowercase letter, one number and one special character, and the password is at least 8 characters long.

If there is an error during installation, you can go to the error log file / var/log/mysqld.log for relevant information. For some Linux platforms, it is necessary to increase the restrictions on the file descriptors available to mysqld.

At this point, I believe you have a deeper understanding of the "rpm installation of MySQL". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report