Mysql5.5.17 source code installation _ MySQL

Source: Internet
Author: User
Tags rehash
1. the Source package is usually compressed using targz. the name contains only version information, which is much smaller than the RPM Package and binary package, the decompressed file contains the INSTALL-SOURCE file, which can be downloaded from the MySQL website (http: wwwmysqlcomdownloads), for example, m 1. download 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]

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.