Compiling and installing MySQL real memory

Source: Internet
Author: User
Tags gz file

Version number: 5.1.72
os:rhel6.5
Installation method: Source code compiled and installed
Process:
1. Visit http://www.mysql.com/downloads/, select the source code in MySQL Community server,select platform, download generic The mysql-5.1.72.tar.gz file under Linux.
2. Upload mysql-5.1.72.tar.gz to server, unzip.
3. Enter the extracted directory and run the following command under this path:

./configure--prefix=/usr/local/mysql--with-charset=utf8 \ Default Character set--with-extra-charsets=all \ Installing additional character sets--with-unix-socket-path=/share/data/mysql.sock \ Using Sockets--with-named-curses-libs=/lib64/libncursesw.so.5

Note:
1) You need to install some software in advance:

Yum Install gcc gcc-c++ perl
Yum Install CMake

(Starting with 5.6.10, MySQL uses cmake instead of the Configure installation, so for 5.1.72, this package may not be needed, to be verified)

Yum Install Ncurses-devel

(--with-named-curses-libs=/lib64/libncursesw.so.5 is said to not specify this parameter, the compilation installation fails, the library file is provided by the Ncurses-devel package)
2)/share/data is the directory where I plan to place the database, and for the convenience of finding and enabling it, the socket directory for communication is also assigned here.

3)(very critical) after the installation of the previous several times, I have a problem when logging in to MySQL, the hint segment error (segmentation fault), later on the Internet to find a method, you need to modify a file in the source package and recompile the installation, Then log in again without encountering this error:

1.  in the source bundle, edit file  cmd-line-utils/libedit/terminal.c2.  find code snippet Similar  char buf[TC_BUFSIZE]; , annotate it, and find the following variable  area = buf;  change it to  area =  NULL; corrected code similar to: 865 protected int866 terminal_set (Editline *el, const char  *term) 867 {868 int i;869 /*char buf[tc_bufsize];*/870 char *area;871  const struct termcapstr *t;872 sigset_t oset, nset;873 int lins,  cols;874875  (void)  sigemptyset (&nset);876  (void)  sigaddset (&nset,  Sigwinch);877  (void)  sigprocmask (sig_block, &nset, &oset); 878879 area =  NULL; This method comes from http://www.111cn.net/database/mysql/79897.htm 

4. Make && make install
5. mysql 5.1.72 compilation installation is complete, next is to start the MySQL service and initialize the database:
It is recommended that you use the system user MySQL to start and stop the MySQL service, so you need to add the MySQL user and MySQL group to the operating system, and modify the MySQL installation location and the directory belonging to the database host group to MySQL:

Chown-r Mysql:mysql/usr/loca/mysqlchown-r mysql:mysql/share/data/

6. Enter the/usr/local/mysql/and perform the database initialization operation:

/usr/local/mysql/bin/mysql_install_db--basedir=/usr/local/mysql/\ prefix--datadir=/share/data/\ Database Location--user= mysql \ Use MySQL user to start and stop MySQL service

7. Start the MySQL service

/usr/local/mysql/bin/mysqld_safe--basedir=/usr/local/mysql--datadir=/share/data--user=mysql &

8. Review the processes and ports to verify that the installation was successful:

#/usr/local/mysql/bin/mysql-uroot-penter Password: \ You do not need to enter the password at this time welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.1.72 Source distributioncopyright (c), +, Oracle and/or its a Ffiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>

The prompt appears and the installation succeeds.

Note:
1) Enter the source directory under the Support-files directory, look for the *.cnf name of the file, this is the configuration file of the different running environment provided by MySQL, copy a suitable to/etc/under the name of the default configuration file my.cnf:

CP ~/MYSQL-5.1.72/SUPPORT-FILES/MY-SMALL.CNF/ETC/MY.CNF

It is necessary to modify or specify the value of the relevant variable in/etc/init.d/mysqld, such as the following:

[Client]socket =/share/data/mysql.sock[mysqld]socket =/share/data/mysql.sock

2) This directory also has a mysql.server file, which is a MySQL-provided LSB script that can be copied to/etc/init.d/and renamed to Mysqld:

CP ~/mysql-5.1.72/support-files/mysql.server/etc/init.d/mysqld

It is necessary to modify or specify the value of the relevant variable in/etc/init.d/mysqld, such as the following:

basedir=/usr/local/mysql/datadir=/share/data/

Postscript:

1. You can designate DataDir as a shared directory to be available to multiple MySQL servers, where you only need to run mysql_install_db operations on one machine, and other servers can be accessed through the MySQL service.

2. It is normal to compile and install once, and many attempts will succeed.

This article is from the "Piano in the Beginning" blog, please be sure to keep this source http://kotori.blog.51cto.com/4819846/1879366

Compiling and installing MySQL real memory

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.