Linux Server configuration Three---lamp mysql compiled installation

Source: Internet
Author: User

    • installation of Mysql

1, mysql version: Community Edition, Enterprise Edition, cluster version,MySQL Workbench (GUI tool) MySQL graphical manager, including management, query and other functions. Percona Open-source MySQL optimization tool,

2. installation package format:

(1)Rpm: Divided into different versions (Red Hat, SUSE, etc.).

Mysql-client Client

Mysql-server server-side

mysql-shared Shared Libraries

Mysql-shared-compat compatible libraries, in order to be compatible with older versions. General installation of the above four packs on it.

Mysql-devel Development components, library files.

Mysql-test test the component.

(2) Universal binary:GCC compiled x86,x64

above need to use cmake compile. 5.5 below with common make compilation, Red Hat 5 6 with CMake need to be installed, but cmake need c++< Span style= "font-family: ' The song Body '; > compiler, g++ or gcc-c++ compiler.

The installation package is divided into : client (mysql.x86_64), server-side (mysql-server.x86_64), profiling component (mysql-bench.x86_ ).

4, after the installation of MYSQL directory structure introduction:

(1) default directory:/var/lib/mysql

The Bin binaries, which contain the client, are on the server side.

Data Number Library

Lib Library file

Include Header File

Man Handbook

Mysql-test

Scripts init script

Share information in different languages

Sql-bench Benchmark Performance Test

The Support-files master configuration file is stored under this file.

5 . After the installation of MySQL, the name and other information :

client-side binary called MySQL

server-side MySQLServer mysqld

Listening Port tcp:3306

MySQL creates a database called MySQL that stores MySQL 's metadata, which is its own system database, so it needs to be initialized after the compilation is installed. If the RPM package is installed, it is not required and will be initialized automatically.

6. mysql configuration file, where the configuration files are loaded when initializing, look for configuration files in the following order.

(1) configuration file Lookup order under Linux:

/etc/my.cnf

/etc/mysql/my.cnf

$MYSQL _home/my.cnf//mysql instance profile, where one server can run multiple instances of MYSQL, as long as the monitor hears a different port number to differentiate it. Each instance will run his instance profile, under his home directory.

a hidden forest file in the ~/.MY.CNF//home directory.

7, source installation 5.5 above version


(1) installation of gcc-c++ and CMake

Yum–y install gcc-c++ cmake make//yum installation, if you do not need to manually compile the installation.

or manually compile the installation.

Cmake. selected Item // similar to the Make tool's ./configure file ( the point after CMake is not available )

Ccmake. or CMAKE–LH// similar to the Make tool ./configure–help

(2) preparing accounts and arrays and directories

Groupadd–rmysql//-r is a system user group.

Useradd-g–r mysql-s/sbin/nologin mysql// Create a new MySQL system user, add users to the group MySQL , and do not allow users to log in.

Mkdir-p/data/mysql// create mysql database storage directory
Chown-r mysql:mysql/data/mysql// set mysql database directory permissions

(3) installing MySQL

Cmake

-dcmake_install_prefix=/usr/local/mysql// installation path

-dmysql_datadir=/data/mysql// data store path

-DSYSCONFDIR=/ETC// configuration file path

generally only with the above three items, the following options with Cmake–ln , see if it can be configured.

Common functions:

-dwith_readline=1 \// Bulk Import

-dwith_ssl:string=bundled \// enable SSL session

-dmysql_tcp_port=3306 \// default port

-dmysql_unix_addr=/tmp/mysql.sock\// default socket file path

-ddefault_charset=utf8 \// Specify the default character set

the default compiled storage engine:

-dwith_innobase_storage_engine=1\//

-dwith-archive_storage_engine=1\

-dwith_blackhole_storage_engine=1 \

Non-compiled storage engine:

-dwithout_example_storage_engine=1\

Make

Make install

(4) Initializing the database

Chown–r MYSQL:MYSQL/USR/LOCAL/MYSQ

/usr/local/mysql/scripts/mysql_install_db--user=mysql--datadir=/data/mysql

--basedir=/usr/local/mysql

(5) copying configuration files to /etc

Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf

and change:basedir and datadir and sock to the specified directory. the Sock will be under temp .

(6) Configuring the Environment

increased to PATH environment variable: to /etc/profie .

Vim/etc/profile added two lines at the end:

Export Mysql_home=/usr/local/mysql

Export path= $PATH: mysql_home

The head file is soft linked to the system header file:

Ln-s/usr/local/mysql/include/mysql/usr/include/mysql

Add the library file to the system library file: (lib folder)

cd/etc/ld.so.conf.d/

Vim mysql.conf

/usr/local/mysql/lib/mysql// Add library files manually ( whether or not you want to follow the MySQL is not ok )

Ldconfig–v re-search the library file for immediate effect.

(7) Configure auto-start

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

chmod a+xmysqld// Add Execute permissions to all users.

The following steps are not required, but can be added, some are not supported Direct chconfig–add command, need to add script header to line.

Add the following two lines under #!/bin/sh.

#chkconfig 345 10 90

#description: Active mysqld

Set the value of these two items to a custom two directory:

Basedir =/usr/local/mysql//mysql program installation path
DataDir =/data/mysql//mysql Database storage directory
Save exit

----------------------------------------------------------------------------------

Chkconfig--add mysqld


This article is from the "Network Line World" blog, please make sure to keep this source http://kuangkuang.blog.51cto.com/838/1695048

Linux Server configuration Three---lamp mysql compiled installation

Related Article

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.