Source code Compilation Install MySQL 5.5.x practice (GO)

Source: Internet
Author: User
Tags chmod mysql version

1. Installing CMake
MySQL has been removed from version 5.5, and is replaced by the CMake tool./configure.
Therefore, we first need to compile and install the CMake tool in the system source code.

# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

# tar ZXVF cmake-2.8.4.tar.gz

# CD cmake-2.8.4

#./configure
# make
# make install

2. Ensure that the following required system packages have been installed
Verify that the following packages are installed by Rpm-qa | grep name.
gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool*

If a related package is missing, it can be installed online via yum-y install, or directly from the system installation CD and installed by RPM-IVH.

3. Pre-installation system settings
Build MySQL installation directory and data storage directory
# Mkdir/opt/mysql
# Mkdir/opt/mysql/data

Create users and user groups
# Groupadd MySQL
# useradd-g MySQL MySQL

Assigning permissions to the data store directory
# chown Mysql:mysql-r/opt/mysql/data

4. Change from Configure to CMake
I believe most people are accustomed to the configure way before, and the parameters used are more personalized, and after CMake, this will bring a lot of trouble.
Fortunately, the official MySQL Web site provides a comparison of the two parameters, we can keep the previous parameters as far as possible, to compile the configuration of the new MySQL version.

configure and CMake parameter comparison guide:
Http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide

Take myself for example, the arguments I've used before are:
./configure--prefix=/opt/mysql/\
--sysconfdir=/opt/mysql/etc \
--localstatedir=/ Opt/mysql/data \
--with-tcp-port=3306 \
--with-unix-socket-path=/tmp/mysqld.sock \
--with-mysqld-user= mysql \
--enable-assembler \
--with-extra-charsets=all \
--enable-thread-safe-client \
-- with-big-tables \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
-- WITH-PLUGINS=PARTITION,INNOBASE,MYISAMMRG

after comparing the parameters with CMake, remove the parameters that have been canceled (mostly because the new version is already enabled by default), the CMake parameters are configured as follows:
cmake-dcmake_install_prefix=/opt/mysql \
- DSYSCONFDIR=/OPT/MYSQL/ETC \
-dmysql_datadir=/opt/mysql/data \
-dmysql_tcp_port=3306 \
-DMYSQL_UNIX_ADDR =/tmp/mysqld.sock \
-dmysql_user=mysql \
-dextra_charsets=all \
-dwith_readline=1 \
-dwith_ssl=system \
-dwith_embedded_server=1 \
-denabled_local_infile=1 \
-dwith_innobase_storage_engine=1

5. Compile and install MySQL 5.5.x
Download the package via the Http://www.mysql.com/downloads/mysql official website or a domestic Sohu image, such as the current MySQL 5.5.13.
# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.13.tar.gz

# Tar zxvf mysql-5.5.13.tar.gz

# cd mysql-5.5.13
# cmake-dcmake_install_prefix=/opt/mysql \
-dsysconfdir=/opt/mysql/etc \
-dmysql_ Datadir=/opt/mysql/data \
-dmysql_tcp_port=3306 \
-dmysql_unix_addr=/tmp/mysqld.sock \
-DMYSQL_USER= mysql \
-dextra_charsets=all \
-dwith_readline=1 \
-dwith_ssl=system \
-dwith_embedded_server=1 \
- denabled_local_infile=1 \
-dwith_innobase_storage_engine=1

# make
# make Install

You can see the percentage of progress when you install make and make, which feels better than the Configure method.

6. Configure and initialize the database
Create a MY.CNF configuration file
# Mkdir/opt/mysql/log

# MKDIR/OPT/MYSQL/ETC
# CP SUPPORT-FILES/MY-MEDIUM.CNF/OPT/MYSQL/ETC/MY.CNF

Initialize database
to be assigned to scripts/mysql_install_db file execution permissions before execution
# chmod 755 scripts/mysql_install_db
# Scripts/mysql_install _db--user=mysql--basedir=/opt/mysql/--datadir=/opt/mysql/data/

Create a shell script that manages the MySQL database
# MKDIR/OPT/MYSQL/INIT.D
# CP Support-files/mysql.server/opt/mysql/init.d/mysql

To give the shell script executable permissions:
# chmod +x/opt/mysql/init.d/mysql

Start MySQL:
#/opt/mysql/init.d/mysql Start

Log in to manage the MySQL server via the command line (enter directly when prompted for the password):
#/opt/mysql/bin/mysql-u Root-p-s/tmp/mysql.sock

Enter the following SQL statement to create a user (admin) and password (12345678) with root privileges:
GRANT all privileges on *. * to ' admin ' @ ' localhost ' identified by ' 12345678 ';
GRANT All privileges on * * to ' admin ' @ ' 127.0.0.1 ' identified by ' 12345678 ';

Set the initial password for the root account
#/opt/mysql/bin/mysqladmin-u root password ' new-password '

Delete the empty password account for the native anonymous connection
/opt/mysql/bin/mysql-uroot-p ' New-password '
mysql>use mysql;//select System database MySQL
mysql> Select Host,user,password from User; View all users
Mysql>delete from user where password= "";
Mysql>flush privileges;
Mysql>select host,user,password from user;//confirm that the user with blank password is all deleted
Mysql>exit;

Http://heylinux.com/archives/993.html

Source code Compilation Install MySQL 5.5.x practice (GO)

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.