【Personal Note】MySQL8.0-Installing MySQL on Unix/Linux Using Generic Binaries

2.2 Installing MySQL on Unix/Linux Using Generic Binaries

Oracle provides a set of binary distributions of MySQL. These include generic binary distributions in the form of compressed tar files (files with a .tar.xz extension) for a number of platfprms, and binaries in platform-specific package formats for selected platforms.

This section covers the installation of MySQL from a compressed tar file binary distribution on Unix/Linux platforms. For Linux-generic binary distribution installation instructions with a focus on MySQL security features, refer to the Secure Depolyment Guide. For other platform-specific binary package formats, see the other platform-specific sections in this manual. For example, for Windows distribution see Section 2.3, “Installing MySQL on Microsoft Windows”. See Section 2.1.3, “How to get MySQL” on how to obtain MySQL in different distribution formats.

MySQL compressesed tar file binary distributions have names of the form mysql-VERSION-OS.tar.xz, where version is a number (for example, 8.0.29), and os indicates the type of os for which the distrition is intended(foe example, pc-linux-i686 or winx64).

There is also a “minimal install” version of the MySQL compressed tar file for the Linux generic binary distribution, which has a name of the form mysql-version-os-glibcver-arch-minimal.tar.xz. The minimal install distribution excludes debug binaries and is stripped of debuig symbols, making it significantly smaller than the regular binary distribution. If you choose to install the minimal install distribution, remember to adjust for the difference in file name format in the instructions that follow.

Warnings
If you have perviously installed MySQL using your os native package management system, such as Yum or APT, you may experence problems installing using a native binary. Make sure your previous MySQL installation has been removed. You should also check for configuration files such as /etc.my.cnf or the /etc/mysql directory and delete them.

For information about replacing third-party packages with offical MySQL packages, see the related APT guide or Yum guide.

MySQL has a dependency on the libaio libary. Data directory initialization and subsequent server startup steps fail if this libary is not installed locally. If necessary, install it using the approprite package manager. For example, on Yum-based systems.

yum search libaio
yum install libaio

or, on APT-based syatems:

apt-cache search libaio
apt-get install libaio

Oracle Linux 8/Red Hat 8(EL8): These platforms by default do not install the file /lib64/libinfo.so.5, which is required by the MySQL client /bin/musql for packages mysql-version-el7-x86_64.tar.gz and m,ysql-version-linux-glibc2.12-x86_64.tar.xz. To work around this issue, install the ncurses-compat-libs package:

yum install ncurses-compat-libs

To install a compressed tar file binary distribution, unpack it at the installation location you choose (typically /usr/local/mysql). This creates the directories shown in the following table.

Table 2.3 MySQL Installation Layout for Generic Unix/Linux Binary Package

|

DirectoryContents of Directory
binmysqld server, client and utility programs
docsMySQL manual in Info format
manUnix manual pages
includeInclude (header) files
libLibraries
shareError messages, dictionary, and SQL for database installation
support-filesMiscellaneous support files

Debug versions of the mysqld binary are available as mysqld-debug. To compile your own debug version of MySQL from a source distribution, use the appropriate configuration options to enable debugging support. See Section 2.9, “Installing MySQL from Source”.

To install and use a MySQL binary distribution, the command sequence looks like this:

groupad d mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local 
tar xvf /path/to/mysql-VERSION-OS.tar.xz
ln -s full-path-to-mysql-version-os mysql
cd mysql 
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql
bin/mysql_ssl_rsa_setuo
bin.mysqld_safe --user=mysql &
#next command is optional
cp support-files/mysql.server /etc/init.d/mysql.server

Note
This procedure assumes that you have root (administrator) access to your system. Alternatively, you can prefix each command using the sudo (Linux) or pfexec (Solaris) command.

Obtain and Unpack the Distribution
Pick the directory under which you want to unpack the distribution and change location into it. The example here unpacks the distribution under /usr/local. The instructions, therefore, assume that you have permission to create files and directories in /usr/local. If that directory is protected, you must perform the installation as root.

$> cd /usr/local

Obtain a distribution file using the instructions in Section 2.1.3, “How to Get MySQL”. For a given release, binary distributions for all platforms are built from the same MySQL source distribution.

Unpack the distribution, which creates the installation directory. tar can uncompress and unpack the distribution if it has z option support:

$> tar xvf /path/to/mysql-VERSION-OS.tar.xz

The tar command creates a directory named mysql-VERSION-OS.

To install MySQL from a compressed tar file binary distribution, your system must have GNU XZ Utils to uncompress the distribution and a reasonable tar to unpack it.

Note
The compression algorithm changed from Gzip to XZ in MySQL Server 8.0.12; and the generic binary’s file extension changed from .tar.gz to .tar.xz.

GNU tar is known to work. The standard tar provided with some operating systems is not able to unpack the long file names in the MySQL distribution. You should download and install GNU tar, or if available, use a preinstalled version of GNU tar. Usually this is available as gnutar, gtar, or as tar within a GNU or Free Software directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is available from http://www.gnu.org/software/tar/.

If your tar does not support the xz format then use the xz command to unpack the distribution and tar to unpack it. Replace the preceding tar command with the following alternative command to uncompress and extract the distribution:

$> xz -dc /path/to/mysql-VERSION-OS.tar.xz | tar x

Next, create a symbolic link to the installation directory created by tar:

$> ln -s full-path-to-mysql-VERSION-OS mysql

The ln command makes a symbolic link to the installation directory. This enables you to refer more easily to it as /usr/local/mysql. To avoid having to type the path name of client programs always when you are working with MySQL, you can add the /usr/local/mysql/bin directory to your PATH variable:

$> export PATH=$PATH:/usr/local/mysql/bin

Perform Postinstallation Setup
The remainder of the installation process involves setting distribution ownership and access permissions, initializing the data directory, starting the MySQL server, and setting up the configuration file. For instructions, see Section 2.10, “Postinstallation Setup and Testing”.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值