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
- sudo apt-get install build-essential
- sudo apt-get install Libncurses5-dev
- sudo apt-get install sysv-rc-conf
- sudo apt-get install CMake
3. Unzip the MySQL source package
[Plain]View Plaincopy
- Tar xvzf mysql-????. tar.gz
4. Create a MySQL user group
[Plain]View Plaincopy
- sudo groupadd MySQL
- sudo useradd-r-g MySQL MySQL
5. Go to MySQL directory after decompression, compile MySQL with cmake instructions
[Plain]View Plaincopy
- CMake. \
- -dcmake_install_prefix=/usr/mysql \
- -dmysql_datadir=/usr/mysql/data \
- -ddefault_charset=utf8 \
- -DDEFAULT_COLLATION=UTF8_GENERAL_CI \
- -dmysql_unix_addr=/tmp/mysqld.sock \
- -dwith_debug=0 \
- -dwith_innobase_storage_engine=1
6, compile and install, use root is relatively simple, the permissions problem is very serious
[Plain]View Plaincopy
- sudo make
- sudo make install
7, into the installation of thick directory execution
[Plain]View Plaincopy
- sudo chown-r MySQL.
- Chgrp-r MySQL.
- sudo bin/scripts/mysql_install_db \
- --user=mysql \
- --basedir=/usr/mysql \
- --datadir=/usr/mysql/data \
- --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
- 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
- sudo cp/usr/mysql/support-files/mysql.server/etc/init.d/mysql
10, establish mysql.pid
[Plain]View Plaincopy
- cd/usr/mysql/
- Touch Mysql.pid
11. Test MySQL Run
[Plain]View Plaincopy
- sudo service MySQL start
or run in the directory
[Plain]View Plaincopy
- 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
- Tail Xxx.err
Generally are permision denied, deal with it yourself
12. Set up the boot operation
[Plain]View Plaincopy
- 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