Install MySQL_MySQL on UNIX

Source: Internet
Author: User
Tags root access
Install MySQL UNIX on unix

You can obtain MySQL distribution packages of several versions. Currently, stable releases include Version 3.22. The currently developing version is 3.23 series. Generally, use the version with the highest serial number in the series.
The MySQL distribution package can be obtained in the format of binary code, RPM, and source code. The binary code and RPM distribution packages are easy to install, but the installation design and default configuration established in the distribution package must be accepted. It is difficult to install the source code distribution package, because the software must be compiled, but more control can be performed on parameters. For example, you can compile only the points of the client program
You can change the target location of the software installation without worrying about the server.
Distribution includes one or more of the following components:
Mysqld server
Client Program (mysql, mysqladmin, etc.) and client programming support environment (library and header file)
Document
Standard database
Language support environment
SOURCE Program and binary code distribution include all the above content. Each RPM file contains only some of the content. Therefore, you may need to install multiple r p m to obtain the required content.
If you want to connect to a server running on another machine, you do not need to install the server, but you should install the client software:
If you do not run the server, you only need the client to connect to the server of another machine.
If you do run a server, you want to be able to connect to the server from the host of the server, instead of logging on to other machines with client software, and then test your server.

MySQL installation overview

To install MySQL on UNIX, perform the following steps:
1) create a user's UNIX account and the group the server will manipulate (if the server is being installed ).
2) obtain and open the distribution package you want to install. If the source code distribution package is used, compile and install it.
3) run the mysql_install_db script to initialize the data directory and permission table (only the first installation is allowed ).
4) start the server.
5) See Chapter 1 to familiarize yourself with general management processes. In particular, read the section on server settings and shutdown, and run the server as a non-privileged user.

Create a MySQL User account

Skip this section if you only need to run the MySQL client without running the MySQL server.
The MySQL server can run as any UNIX user on the system, but it is best not to run the server as root for security and confidentiality reasons. We recommend that you create an independent account for MySQL management and run the server with this user. In this way, you can log on as the user and have full permissions in the directory for maintenance and troubleshooting. Create
The user account process varies with the system. For more information, see the relevant document.
This book uses mysqla d m and mysqlg r p for the group names of UNIX users and this account respectively. If you want to install MySQL only for your own use, you can run it on your own. the mysqladm and mysqlg r p appearing anywhere in this book can be replaced with your own login name and group name. If the RPM file is installed, a user named mysql is automatically created along with the RPM installation process. In this case, you can replace mysql with mysqla d m.
Using an independent, non-privileged account rather than running MySQL's r o t has the following advantages:
If MySQL is not run as root, no one can exploit this server's security vulnerability to obtain root access.
Unprivileged users perform MySQL management tasks more securely than root users.
The server will create files owned by mysqladm instead of root. The fewer files that r o t has on the system, the better.
Separating MySQL activities in its own account makes it clearer in concept and makes it easier to see what is related to MySQL on the system. For example, in the directory where the core file is saved, there is an independent file of MySQL User mysqladm. Otherwise, the MySQL corn job will be located in the root file and will be periodically executed as the root together with other things.

Obtain and install the MySQL distribution package

In the following description, we use a version to represent the MySQL version number and a platform to represent the platform name for installation. They are also used in the distribution package file name to easily identify the distribution package and differentiate each distribution package. The version number is something like 3.22.26 or 3.23.4-alpha, and the platform name is something like a sgi-irix6.3-mips or d e c-osf4-0b-alpha.
1. install the binary code distribution package
The binary code distribution package file has a name such as m s q l-ver s I o n-p l a t f o r m. t a r.gz. Obtain the distribution package file of the ideal version and platform and put it into the specified installation MySQL Directory, such as/us r/l o c a l.
Open the distribution package with any of the following commands (if the tar version does not support the z option of the non-compressed distribution package, use the second command ):
Mysql-version-platform.tar.gz % tar zxf
% Gunzip | mysql-version-platfrom.tar.gz | tar xf
Open the distribution package and create the directory mysql-ver s I o n-p l a t f o r m that contains the distribution package content. To make it easier to reference this directory, you can create a symbolic connection:
% Ln-s mysql-version-platorm mysql now, if you install MySQL in the/usr/local directory, the reference installation directory is/us r/l o c a l/mysql.
If you only want to use the client support environment provided by the distribution package and do not run the server, the installation is complete. For the first installation of MySQL, see section 3.4 "initialize data directory and permission table ". If you want to update an existing installation, see section 3.5 "start server ".
2. install the RPM distribution package
The RPM file can be used for MySQL installation on Linux. They have the following file names:
MySQL-ver s I o n-p l a t f o r m. rpm server software.
MySQL-c l I e n t. ver s I o n-p l a t f o r m. rpm client program.
MySQL-d e v e l. ver s I o n-p l a t f o r m. rpm compile the development support environment of the client program (client library and header file ). If you want to use or write a Perl DBI script to access the MySQL database, you need to use it.
MySQL-B e n c h. ver s I o n-p l a t f o r m. rpm standard and test. The Perl and Msql-Mysql-modules are required. You can obtain an RPM file for Mysql-modules on w w.mysql.com.
Source code for MySQL-ver s I o n. src. rpm servers, clients, standards, and tests.
If you install the file from RPM, no specific directory is required because the RPM file contains information that specifies where to install the contained file. For any RPM file r p m _ f I l e, use the following command to know where the content will be installed:
% Rpm-qpl rpm_file
To install an RPM file, run the following command:
% Rpm-I rpm_file
The components of MySQL are divided into different RPM files, so more than one r p m may need to be installed. To install the client support environment, run the following command:
% Rpm-I MySQL-client-version-platform.rpm
Run the following command to install the server support environment:
% Rpm-I MySQL-version-platform.rpm
If you plan to write your own program using the client programming support environment, you should install the RPM file for development:
% Rpm-I MySQL-devel-version-platform.rpm
If you plan to use the client support environment provided by the distribution package and do not want to use the server, the installation of MySQL will end. For the first installation of MySQL, see section 3.4 "initialize data directory and permission table ". If you want to update the existing installation, see section 3.5 "start server ".
If you want to install it from the source code RPM file, use the following command:
% Rpm -- recompile MySQL-version.src.rpm
3. install the source code distribution package
The source code distribution package has names such as mysql-ver s I o n. t a r.gz, where version is the MySQL version. Select the directory under which you want to put the distribution package and enter the directory. Obtain the distribution package file and open it with one of the following commands (if the tar version does not support the z option of the non-compressed distribution package, use the second command ):
Mysql-version.tar.gz % tar zxf
% Gunzip | mysql-version.tar.gz | tar xf
Open the mysql-ver s I o n directory that contains the distribution package content and enter it.
% Cd mysql-version
Before installation, you must configure and compile the distribution package. If the steps fail, refer to the "install MySQL" chapter in the MySQL Reference Guide. pay special attention to the system instructions related to various machines.
Use the configure command to configure the distribution package:
%./Configure
You can specify options for configure. To obtain the available option table, run the following command:
%./Configu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.