Install mysql5.5.17 source code and mysql5.5.17 source code

Source: Internet
Author: User
Tags rehash

Install mysql5.5.17 source code and mysql5.5.17 source code
1. Download the source code package
SOURCE code package is often compressed tar.gz, the name only contains version information, the size is much smaller than the RPM package, Binary Package, the decompressed file contains INSTALL-SOURCE file, can be from the MySQL official website (http://www.mysql.com/downloads) download, such as: mysql-5.5.17.tar.gz
2. CMake
Before using the source code package to install MySQL instances, we will first introduce the cmake compilation tool. Before MySQL 5.5, the configure tool was used to compile the source code. in MySQL 5.5, cmake was used for compilation. This is a more advanced compilation Configuration tool than make, according to different platforms, different compilers, production of the corresponding Makefile or vcproj project, so first from the official website (http://www.cmake.org) download and install the cmake tool.
Install the gcc package before installing cmake
Rpm-ivh kernel-headers-2.6.18-308.el5.x86_64.rpm
Rpm-ivh glibc-headers-2.5-81.x86_64.rpm
Rpm-ivh glibc-devel-2.5-81.x86_64.rpm
Rpm-ivh gcc-4.1.2-52.el5.x86_64.rpm
Rpm-ivh libstdc ++ devel-4.1.2-52.el5.x86_64.rpm
Rpm-ivh gcc-c ++-4.1.2-52. el5.x86 _ 64.rpm
Install cmake
/Mysql/cmake-2.8.3
./Configure
Gmake & make install
 
 
3. Install mysql 5.5.17
1. Create a mysql system group and user
Groupadd mysql
Useradd-g mysql
 
2. Set limits on Operating System Resources
 
Vi/etc/security/limits. conf
Mysql soft nproc 2047
Hard nproc 16384
Mysql soft nofile 1024
Mysql hard nofile 65536
Installation Package
# Rpm-ivh ncurses-devel-5.5-24.20060715.x86_64.rpm
# Rpm-ivh bison-2.3-2.1.x86_64.rpm
 
 
3. Install MYSQL Server
# Mkdir/opt/mysql
# Chown-R mysql: mysql/opt/mysql
# Gunzip mysql-5.5.17.tar.gz
# Tar xvf mysql-5.5.17.tar
# Cd mysql-5.5.17
# Cmake-DCMAKE_INSTALL_PREFIX =/opt/mysql \
>-DMYSQL_USER = mysql \
>-DMYSQL_TCP_PORT = 3306 \
>-DMYSQL_DATADIR =/opt/mysql/data \
>-DWITH_MYISAM_STORAGE_ENGINE = 1 \
>-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
>-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
>-DWITH_MEMORY_STORAGE_ENGINE = 1 \
>-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
>-DWITH_PARTITION_STORAGE_ENGINE = 1 \
>-DENABLED_LOCAL_INFILE = 1 \
>-DWITH_READLINE = 1 \
>-DWITH_SSL = yes \
>-DDEFAULT_CHARSET = utf8 \
>-DDEFAULT_COLLATION = utf8_general_ci \
>-DEXTRA_CHARSETS = all

# Make
# Make install

Initialize DB
# Sh scripts/mysql_install_db -- user = mysql -- basedir =/opt/mysql -- datadir =/opt/mysql/data
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system

Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:

/Opt/mysql/bin/mysqladmin-u root password 'new-password'
/Opt/mysql/bin/mysqladmin-u root-h mysql password 'new-password'

Alternatively you can run:
/Opt/mysql/bin/mysql_secure_installation

Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Stronugly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon:
Cd/opt/mysql;/opt/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
Cd/opt/mysql-test; perl mysql-test-run.pl

Please report any problems with the/opt/mysql/scripts/mysqlbug script!
 
 
 
4. Start Mysql Sever
Configure service
# Cp/opt/mysql/files/mysql. server/etc/init. d/mysql -- configure basedir and datadir
Configure mysql parameter file my. cnf
 
 
# Vi/etc/my. cnf
[Client]
# Password = your_password
Port = 3306
Socket =/opt/mysql/data/mysql. sock
 
[Mysqld]
Port = 3306
Server-id = 24
Datadir =/opt/mysql/data
Socket =/opt/mysql/data/mysql. sock
Pid-file =/opt/mysql/data/mysql. pid
Character-set-server = utf8
Default_storage_engine = InnoDB
Log-bin =/opt/mysql/data/mysql-bin
Binlog_format = row
Sync-binlog = 1
Slow-query-log = on
Slow-query-log-file =/opt/mysql/data/mysql-slow.log
Log_error =/opt/mysql/data/mysql. err
Max_connections = 2000
Back_log = 50
Skip-external-locking
Skip-name-resolve
 
Key_buffer_size = 256 M
Max_allowed_packet = 1 M
Table_open_cache = 2000
Sort_buffer_size = 1 M
Read_buffer_size = 1 M
Read_rnd_buffer_size = 4 M
Myisam_sort_buffer_size = 64 M
Thread_cache_size = 8
Query_cache_size = 16 M
Thread_concurrency = 8
 
Innodb_data_home_dir =/opt/mysql/data
Innodb_data_file_path = ibdata1: 10 M: autoextend
Innodb_log_group_home_dir =/opt/mysql/data
Innodb_buffer_pool_size = 256 M
Innodb_additional_mem_pool_size = 20 M
Innodb_log_file_size = 64 M
Innodb_log_buffer_size = 8 M
Innodb_flush_log_at_trx_commit = 1
Innodb_lock_wait_timeout = 50
 
[Mysqldump]
Quick
Max_allowed_packet = 16 M
 
[Mysql]
No-auto-rehash
# Safe-updates
 
[Myisamchk]
Key_buffer_size = 128 M
Sort_buffer_size = 128 M
Read_buffer = 2 M
Write_buffer = 2 M
 
[Mysqlhotcopy]
Interactive-timeout
 
"/Etc/my. cnf" [New] 62L, 1531C written
[Root @ mysql support-files] # more/etc/my. cnf
[Client]
# Password = your_password
Port = 3306
Socket =/opt/data/mysql. sock
 
[Mysqld]
Port = 3306
Server-id = 24
Datadir =/opt/mysql/data
Socket =/opt/mysql/data/mysql. sock
Pid-file =/opt/mysql/data/mysql. pid
Character-set-server = utf8
Default_storage_engine = InnoDB
Log-bin =/opt/mysql/data/mysql-bin
Binlog_format = row
Sync-binlog = 1
Slow-query-log = on
Slow-query-log-file =/opt/mysql/data/mysql-slow.log
Log_error =/opt/mysql/data/mysql. err
Max_connections = 2000
Back_log = 50
Skip-external-locking
Skip-name-resolve
 
Key_buffer_size = 256 M
Max_allowed_packet = 1 M
Table_open_cache = 2000
Sort_buffer_size = 1 M
Read_buffer_size = 1 M
Read_rnd_buffer_size = 4 M
Myisam_sort_buffer_size = 64 M
Thread_cache_size = 8
Query_cache_size = 16 M
Thread_concurrency = 8
 
Innodb_data_home_dir =/opt/mysql/data
Innodb_data_file_path = ibdata1: 10 M: autoextend
Innodb_log_group_home_dir =/opt/mysql/data
Innodb_buffer_pool_size = 256 M
Innodb_additional_mem_pool_size = 20 M
Innodb_log_file_size = 64 M
Innodb_log_buffer_size = 8 M
Innodb_flush_log_at_trx_commit = 1
Innodb_lock_wait_timeout = 50
 
[Mysqldump]
Quick
Max_allowed_packet = 16 M
 
[Mysql]
No-auto-rehash
# Safe-updates
 
[Myisamchk]
Key_buffer_size = 128 M
Sort_buffer_size = 128 M
Read_buffer = 2 M
Write_buffer = 2 M
 
[Mysqlhotcopy]
Interactive-timeout
 
 
# Service mysql start
Starting MySQL... [OK]
How does one download the mysql source code package officially?

Downloads.mysql.com/..w.other

Source and other files5.6.10
X86 (23 Jan 2013,275.7 M) SignatureMD5: ccecf1e1843a0165f7b67bc5bfc0b145
ZIP format (23 Jan 2013, 40.9 M) SignatureMD5: 861e49d3096a1c98f7abd083a65778b6
X86, 64-bit (23 Jan 2013,283.5 M) SignatureMD5: b8f70c35e50cf49a4c8ed01d731b7d64
Mysql-5.6.10.tar.gz (23 Jan 2013, 33.5 M) SignatureMD5: 9dcee911fb4bc7e977a6b63f4d3ffa63

There are
Click the mysql-5.6.10.tar.gz directly
Or find another version...

Pass the score ..

The specific parameters of the latest mysql source code compilation and Installation Method in Linux are described in the following section.

The following is the configuration experience of CentOS Linux 5:
Add a mysql account
Groupadd mysql
Useradd-r-g mysql
Installation is required before compilation.
Cmake-2.8.4 and bison-2.4.3
Decompress mysql-5.5.15.tar.gz after successful installation:
Open the terminal in the source code root directory and enter the following configuration parameters and press Enter.
Cmake-DCMAKE_INSTALL_PREFIX =/etc/mysql \
-DMYSQL_UNIX_ADDR =/etc/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_DATADIR =/var/mysql/data \
-DMYSQL_USER = mysql

After successfully executing the following command, you will be able to see it at the end (/root/Desktop/is your source code directory, depending on your situation)
-- Build files have been written to:/root/Desktop/mysql-5.5.15

Run make to install:
Make
Make install
The following steps are not described in detail:
Cd/mysql
Chown-R mysql: mysql.
Scripts/mysql_install_db -- user = mysql
Chown-R root.
Chown-R mysql data
Cp./support-files/my-small.cnf./my. cnf
Cp support-files/mysql. server mysql; chmod + x mysql
Chown-R mysql: root.
./Mysql start
./Bin/mysqladmin-u root-p 123456

Add startup Service
Chkconfig -- add mysql
Chkconfig mysql on
Service mysql start

If everything goes well, it will be done here. I wish you success.

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.