Compile and install mysql (Ubuntu10 64-bit)

Source: Internet
Author: User
Tags gmp

A good compiler and a good compiler option are used to improve application performance. This is very important to most programs.

Mysql

For more information about the old configuration, see

This form is mainly used

Http://www.cnblogs.com/hemhem/archive/2011/03/14/2087481.html

Http://blog.csdn.net/bing19880122/article/details/5830650

Http://flyingdutchman.iteye.com/blog/1901149

MySQL cMake http://waynerqiu.com/7/153.html

New Cmake Configuration

Http://www.cmake.org/

Http://www.cnblogs.com/2018/p/3091616.html

 

Mysql

Http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html

Http://dev.mysql.com/doc/refman/5.6/en/environment-variables.html

Environment Variables and configurable

The following is an example.

# CMAKE_BUILD_TYPE Debug:-g Release:-O2 RelWithDebInfo:-O2-g MinSizeRel:-OS

# WITH_EMBEDDED_SERVER Whether to build the libmysqld embedded server library.

# WITH_PARTITION_STORAGE_ENGINE

#-Dwith_133 = 1 \ # must gcc> 4.5

# DENABLE_DOWNLOADS google MOCK test

Cmake .\

-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DCMAKE_BUILD_TYPE = Release \

-DSYSCONFDIR =/etc \

-DINSTALL_SBINDIR =/usr/local/mysql/bin \

-DMYSQL_DATADIR =/usr/local/mysql/data \

-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \

-DENABLED_LOCAL_INFILE = 1 \

-DMYSQL_TCP_PORT = 3306 \

-DDEFAULT_CHARSET = utf8 \

-DDEFAULT_COLLATION = utf8_general_ci \

-DWITH_EMBEDDED_SERVER = 0 \

-DWITH_MYISAM_STORAGE_ENGINE = 1 \

-DWITH_INNOBASE_STORAGE_ENGINE = 1 \

-DWITH_PARTITION_STORAGE_ENGINE = 1 \

-DWITH_ARCHIVE_STORAGE_ENGINE = 0 \

-DWITH_BLACKHOLE_STORAGE_ENGINE = 0 \

-DWITH_MEMORY_STORAGE_ENGINE = 0 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE = 0 \

-DWITH_EXTRA_CHARSETS = none \

-DWITH_DEBUG = 0 \

#-Dwith_1_= 1 \

#-DENABLE_DOWNLOADS = 0 \

# End of cmake

Note:

 

GCC

Http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.gz download from here

You can use the following script to upgrade

 

#! /Bin/bash

# Gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5. 1)

: <EOF

Ftp://gcc.gnu.org/pub/gcc/infrastructure/

GNU Multiple Precision Library (GMP) version 4.3.2 (or later)

MPFR Library version 2.4.2 (or later)

MPC Library version 0.8.1 (or later)

EOF

 

Gccver = 4.8.2

Gmpver = 4.3.2

Mpfrver = 2.4.2

Mpcver = 0.8.1

# Where you put the downloaded source packages

Pkgdir =.

 

# Where you will build gcc

Rootdir = gcc-$ {gccver}

# Where you want to install gcc

Prefix =/opt/gcc-$ {gccver}

# The editions you want gcc to support

Langs = c, c ++

 

#0 unpack file

: <EOF

# Create a new directory on a disk with plenty of space and unpack the sources there:

Mkdir-p $ {rootdir}

Tar xzf $ {pkgdir}/gcc-w.w.gccver=.tar.gz

Tar xjf ${pkgdir}/gmp-1_gmpver=.tar.bz2

Tar xjf ${pkgdir}/mpfr-?mpfrver=.tar.bz2

Tar xzf $ {pkgdir}/mpc-shanghaimpcver=.tar.gz

# Next, move the prerequisite sources into the gcc source directory:

Mv gmp-$ {gmpver }$ {rootdir}/gmp

Mv mpfr-$ {mpfrver }$ {rootdir}/mpfr

Mv mpc-$ {mpcver }$ {rootdir}/mpc

EOF

 

#

#1.1 build on source dir

Pushd $ {rootdir}

# Make clean

#

./Configure -- prefix =$ {prefix} -- enable-languages =$ {langs} -- disable-multilib

 

Make

Make install

 

Popd

 

#1.2 build on other dir

: <EOF

# Now create a build directory and change to it

Mkdir-p objdir

Cd objdir

 

# Now configure gcc:

Mkdir-p $ {prefix}

../$ {Rootdir}/configure -- prefix =$ {prefix} -- enable-languages =$ {langs} -- disable-multilib

# Configure -- prefix =/opt/gcc-4.8.2 -- enable-languages ages = c, c ++

 

# Now build gcc:

Make

 

# Finally, install gcc:

Make install

# Fixdocumdes

Cd ..

EOF

 

###

 

#2

#

Sudo update-alternatives -- remove-all gcc

Sudo update-alternatives -- remove-all g ++

Sudo update-alternatives -- install/usr/bin/gcc/opt/gcc-4.8.2/bin/gcc 40

Sudo update-alternatives -- install/usr/bin/g + + + g ++/opt/gcc-4.8.2/bin/g ++ 40

#

Sudo update-alternatives -- config gcc

Sudo update-alternatives -- config g ++

 

#3

Rm-f/usr/lib/libstdc ++ *

Cp-f/opt/gcc-4.8.2/lib64/libstdc ++. so.6.0.18/usr/lib /.

Cp-f/opt/gcc-4.8.2/lib64/libstdc ++. so.6/usr/lib /.

 

Note that

 

Of course, there are some simplified methods that need to be upgraded over the Internet, as described below

Http://www.qtcn.org/bbs/apps.php? Q = diary & a = detail> did = 1456 & uid = 139371

Compile and install

Now you can add

 

Note: to improve performance, you only need to compile the required functions.

 

After successful installation, it is very simple, similar to the following script Process

Make install

# Sudo cp-f my. cnf/etc/my. cnf

# Sudo chmod 0444/etc/my. cnf

Sudo sh-c 'groupadd mysql'

Sudo sh-c 'useradd-r-g mysql mysql'

Sudo chown-R mysql/usr/local/mysql/data

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

# Sudo cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql

/Usr/local/mysql/support-files/mysql. server start

Login = "/usr/local/mysql/bin/mysql-uroot-D mysql-e"

Pass = "/usr/local/mysql/bin/mysql-uroot-p123456-D mysql-e"

$ {Login} "update mysql. user set password = PASSWORD ('000000') where user = 'root ';"

$ {Login} "flush privileges ;"

 

 

Detailed material and Script Reference http://pan.baidu.com/s/1Cc7cr

Gcc

Because of the new version

#! /Bin/bash

 

If [$ # = 1]; then

#4.4

#

Sudo update-alternatives -- remove-all gcc

Sudo update-alternatives -- remove-all g ++

Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.4 40

Sudo update-alternatives -- install/usr/bin/g ++-4.4 40

#

Sudo update-alternatives -- config gcc

Sudo update-alternatives -- config g ++

 

#

# Rm-f/usr/lib/libstdc ++ *

# Cp-f gcc4.4/libstdc ++. so.6.0.13/usr/lib /.

# Ln-s/usr/lib/libstdc ++. so.6.0.13/usr/lib/libstdc ++. so.6

Else

#4.8

#Gcc-4.8.2.tar.gz

If [-d/opt/gcc-4.8.2]; then

Echo "gcc 4.8.2 installed"

Else

Tar xzf gcc-4.8.2.tar.gz-C/opt

Fi

#

Sudo update-alternatives -- remove-all gcc

Sudo update-alternatives -- remove-all g ++

Sudo update-alternatives -- install/usr/bin/gcc/opt/gcc-4.8.2/bin/gcc 40

Sudo update-alternatives -- install/usr/bin/g + + + g ++/opt/gcc-4.8.2/bin/g ++ 40

#

Sudo update-alternatives -- config gcc

Sudo update-alternatives -- config g ++

 

#

# Rm-f/usr/lib/libstdc ++ *

# Cp-f/opt/gcc-4.8.2/lib64/libstdc ++. so.6.0.18/usr/lib /.

# Cp-f/opt/gcc-4.8.2/lib64/libstdc ++. so.6/usr/lib /.

Fi

 

# Libstdc ++. so.6

 

Gcc-v

References

Here is the relevant information and content http://pan.baidu.com/s/1Cc7cr

 

Http://www.cnblogs.com/2018/p/3482263.html

Http://www.cnblogs.com/2018/p/3464638.html

These two articles have already introduced the process of installing clang and compiling the c ++ library. Next we will talk about the clang compilation and Installation Process of mysql.

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.