MySQL database installation configuration arrangement in Linux system

Source: Internet
Author: User


MySQL Installation

1, download the MySQL source package through the official website. http://dev.mysql.com/downloads/Click MySQL Community Server, select Source Code, click Generic Linux

(architecture independent), compressed download after TAR archive wget
/mysql-5.6.20.tar.gz
# tar zxvf mysql-5.6.20.tar.gz
# CD mysql-5.6.20

2, Installation CMake (mysql5.5 after the source installation must be compiled through the CMake, and installed ncurses Ncurses-devel

# yum-y Install CMake ncurses ncurses-devel

# groupadd MySQL

# useradd-g MySQL MySQL

3. Compile and install

# CMake. -dcmake_install_prefix=/usr/local/webserver/mysql-dmysql_datadir=/usr/local/webserver/mysql-dsysconfdir=/usr/ Local/webserver/mysql-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra_charsets=all-denabled_ local_infile=1

# make && make install


Parameter description:
-dcmake_install_prefix=/usr/local/webserver/mysql//Specify installation directory
-dinstall_datadir=/usr/local/webserver/mysql//Designated Data storage directory
-dsysconfdir=/usr/local/webserver/mysql//Specifies the profile directory (in this case the configuration file is/opt/mysql/my.cnf)
-ddefault_charset=utf8//specified character set
-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Specify checksum character
-dextra_charsets=all//Install all extended character sets
-denabled_local_infile=1//Allow import of data from local

Compile error should be deleted CMakeCache.txt

# RM CMakeCache.txt

Copy the MySQL configuration file and configure it accordingly, where the server is the Aliyun minimum configuration, single core 512M memory.

# cd/usr/local/webserver/mysql

# chown-r Mysql:mysql data/

# cp support-files/my-default.cnf my.cnf

# VI my . cnf

Edit MY.CNF

[Mysqld]

innodb_buffer_pool_size = 100M

Basedir =/usr/local/webserver/mysql

datadir =/usr/local/webserver/mysql/data

port = 3306

server_id = 1

socket =/tmp/mysql.sock

Join_buffer_size = 10M

sort_buffer_size = 10M

read_rnd_buffer_size = 12M

query_cache_size = 32m< C14/>tmp_table_size = 32M

key_buffer_size = 32M

performance_schema_max_table_instances=1000

table_definition_cache=800

table_open_cache=512

long_query_time=1

slow_query_log=1

Slow_query_log_file=/usr/loca/webserver/mysql/data/slow-queries.log

Log_queries_not_using_indexes=1

Sql_mode=no_engine_substitution,strict_trans_tables

Initializing the MySQL Database

/usr/loca/webserver/mysql/scripts/mysql_install_db--user=mysql

Start MySQL


#./support-files/mysql.server Start
Error

Starting MySQL. error! The server quit without updating PID file (/usr/local/webserver/mysql/data/ay121218115148c506503.pid).

2014-08-14 11:29:38 1678 [note] innodb:using mutexes to ref count buffer pool pages
2014-08-14 11:29:38 1678 [note] innodb:the InnoDB memory heap is disabled
2014-08-14 11:29:38 1678 [note] innodb:mutexes and rw_locks use InnoDB ' s own implementation
2014-08-14 11:29:38 1678 [note] innodb:memory barrier are not used
2014-08-14 11:29:38 1678 [note] innodb:compressed tables use zlib 1.2.3
2014-08-14 11:29:38 1678 [note] Innodb:not using CPU CRC32 instructions
2014-08-14 11:29:38 1678 [note] innodb:initializing buffer pool, size = 100.0M
Innodb:mmap (106840064 bytes) failed; errno 12
2014-08-14 11:29:38 1678 [ERROR] Innodb:cannot allocate memory for the buffer pool
2014-08-14 11:29:38 1678 [ERROR] Plugin ' InnoDB ' init function returned ERROR.
2014-08-14 11:29:38 1678 [ERROR] Plugin ' InnoDB ' registration as a STORAGE ENGINE.
2014-08-14 11:29:38 1678 [ERROR] unknown/unsupported storage Engine:innodb
2014-08-14 11:29:38 1678 [ERROR] aborting
Unable to allocate 100M memory to the innodb_buffer_pool_size, but there is actually memory before starting MySQL.
Mysql5.6 has several default values, starting with these values requires hundreds of megabytes of memory, and then allocated to Innodb_buffer_pool_size is not enough, the server poor 512M memory ...

performance_schema_max_table_instances = 12500

table_definition_cache = 1400

table_open_cache = 2000

Adjust

performance_schema_max_table_instances=600

table_definition_cache=400

table_open_cache=256

Just use---60M of memory, restart MySQL

#./support-files/mysql.server start

starting MySQL. success! 

# CP./support-files/mysql.server/etc/rc.d/init.d/mysqld

# chmod 755/etc/init.d/mysqld

# Chkconfig mysqld on

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.