"Go" ubuntu compile install MySQL source code

Source: Internet
Author: User

Mainly refer to the following two articles

http://forum.ubuntu.org.cn/viewtopic.php?t=330121

Http://www.linuxidc.com/Linux/2011-09/42290.htm

1, go to MySQL official website to download the latest source code, download page drop-down menu selected source Code->generic Linux????. tar.gz

2, update the system must have tools

[Plain]View Plaincopy
    1. sudo apt-get install build-essential
    2. sudo apt-get install Libncurses5-dev
    3. sudo apt-get install sysv-rc-conf
    4. sudo apt-get install CMake

3. Unzip the MySQL source package

[Plain]View Plaincopy
    1. Tar xvzf mysql-????. tar.gz

4. Create a MySQL user group

[Plain]View Plaincopy
    1. sudo groupadd MySQL
    2. sudo useradd-r-g MySQL MySQL


5. Go to MySQL directory after decompression, compile MySQL with cmake instructions

[Plain]View Plaincopy
    1. CMake. \
    2. -dcmake_install_prefix=/usr/mysql \
    3. -dmysql_datadir=/usr/mysql/data \
    4. -ddefault_charset=utf8 \
    5. -DDEFAULT_COLLATION=UTF8_GENERAL_CI \
    6. -dmysql_unix_addr=/tmp/mysqld.sock \
    7. -dwith_debug=0 \
    8. -dwith_innobase_storage_engine=1


6, compile and install, use root is relatively simple, the permissions problem is very serious

[Plain]View Plaincopy
    1. sudo make
    2. sudo make install


7, into the installation of thick directory execution

[Plain]View Plaincopy
    1. sudo chown-r MySQL.
    2. Chgrp-r MySQL.
    3. sudo bin/scripts/mysql_install_db \
    4. --user=mysql \
    5. --basedir=/usr/mysql \
    6. --datadir=/usr/mysql/data \
    7. --no-defaults


There must be a –no-defaults option, and if this option is not available, the program will automatically load the default configuration file

8, Configuration My.cnf

[Plain]View Plaincopy
    1. sudo cp/usr/mysql/support-files/my-medium.cnf/etc/mysql/my.cnf

Usually we start mysqld by passing in the appropriate parameters to the script. So add the following in the/ETC/MYSQL/MY.CNF:

References:[Mysqld]
Basedir=/usr/mysql
Datadir=/usr/mysql/data
User=mysql

Pid-file =/usr/mysql/mysql.pid

9. Copy Service Control files

[Plain]View Plaincopy
    1. sudo cp/usr/mysql/support-files/mysql.server/etc/init.d/mysql


10, establish mysql.pid

[Plain]View Plaincopy
    1. cd/usr/mysql/
    2. Touch Mysql.pid


11. Test MySQL Run

[Plain]View Plaincopy
    1. sudo service MySQL start

or run in the directory

[Plain]View Plaincopy
    1. Sudo/etc/init.d/mysql start

Error handling what PID errors, should be no permissions caused, the specific error can go to/usr/mysql/data/xxxx.err view

View methods

[Plain]View Plaincopy
    1. Tail Xxx.err

Generally are permision denied, deal with it yourself


12. Set up the boot operation

[Plain]View Plaincopy
    1. sudo sysv-rc-conf

The tool is a graphical interface, very intuitive here does not describe how to use, we need to do is to find the "MySQL" column, selected "3" "4" "5" the three columns, so that completed the boot automatically start MySQL daemon.

Service MySQL status after restart

MySQL is running

It worked

"Go" ubuntu compile install MySQL source code

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.