MySQL 5.6.29 source code compilation and installation records

Source: Internet
Author: User
Tags account security

MySQL 5.6.29 source code compilation and installation records
MySQL 5.6.29 source code compilation and installation record 1. installation environment 1. Operating System: CentOS 6.7 x86_64

# Yum install make cmake gcc-c ++ gcc-g77 flex bison file libtool-libs autoconf kernel-devel patch wget libjpeg-devel libpng-devel libpng10 libpng10-devel gd-devel libxml2 libxml2-devel zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel kernel-devel ncurses-devel curl-devel kernel e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel vim-minimal gettext -devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel perl
2. cmake has been installed in yum mode and does not need to be installed again.

3. MySQL version: mysql-5.6.29.tar.gz4. The same sample installation method is also applicable to mysql-5.5.x.tar.gz、installation mysql-5.6.29.tar.gz 1. Download the compiled version mysql Installation

Tar zxvf mysql-5.6.29.tar.gz
Cd mysql-5.6.29
Patch-p1 <../mysql-openssl.patch
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/usr/local/mysql/data-DSYSCONFDIR =/etc-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DEXTRA_CHARSETS = gbk, gb2312, utf8, ascii-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_READLINE = 1-DWITH_SSL = system-DWITH_ZLIB = system-runtime = 1-runtime = 1-runtime = 1-runtime = 1-runtime = 1-DWITH_BLACKHOLE_STORAGE_ENGINE = 1-DWITH_PARTITION_STORAGE_ENGINE = 1-DWITH_PERFSCHEMA_STORAGE_ENGINE = 1-DWITH_FAST_MUTEXES = 1-DWITH_DEBUG = 0
Make & make install

Note: You can use the following method to re-compile the translation. You can delete the relevant parameters without using ssl.
Make clean
Rm-f CMakeCache.txt

2. Prepare mysql users

Groupadd mysql
Useradd-g mysql-M-s/sbin/nologin mysql

3. initialize mysql and use the default database location

Chown-R mysql: mysql/usr/local/mysql
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data

4. mysql service configuration

Cd/usr/local/mysql
Cp support-files/my-medium.cnf/etc/my. cnf
Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig mysqld on

5. Configure the Mysql command link

Ln-sf/usr/local/mysql/bin/mysql/usr/bin/mysql
Ln-sf/usr/local/mysql/bin/mysqldump/usr/bin/mysqldump
Ln-sf/usr/local/mysql/bin/myisamchk/usr/bin/myisamchk
Ln-sf/usr/local/mysql/bin/mysqld_safe/usr/bin/mysqld_safe

Or you can add it to the environment variable.

# Vi/etc/profile
Export PATH =/usr/local/mysql/bin/: $ PATH
# Source/etc/profile

6. Configure other

Ln-sv/usr/local/mysql/include/usr/include/mysql
Echo '/usr/local/mysql/lib'>/etc/ld. so. conf. d/mysql. conf
Ldconfig

7. Mysql configuration file

Vi/etc/my. cnf

[Client]
Port = 3306
Socket =/tmp/mysql. sock

# The MySQL server
[Mysqld]
Port = 3306
Socket =/tmp/mysql. sock
Datadir =/usr/local/mysql/data
Skip-external-locking
Max_connections = 1000
Key_buffer_size = 16 M
Max_allowed_packet = 1 M
Table_open_cache = 64
Sort_buffer_size = 512 K
Net_buffer_length = 8 K
Read_buffer_size = 256 K
Read_rnd_buffer_size = 512 K
Myisam_sort_buffer_size = 8 M

# Skip-networking

Log-bin = mysql-bin
Binlog_format = mixed
Server-id = 1

Innodb_data_home_dir =/usr/local/mysql/data
Innodb_data_file_path = ibdata1: 10 M: autoextend
Innodb_log_group_home_dir =/usr/local/mysql/data
Innodb_buffer_pool_size = 16 M
Innodb_additional_mem_pool_size = 2 M
Innodb_log_file_size = 5 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

[Myisamchk]
Key_buffer_size = 20 M
Sort_buffer_size = 20 M
Read_buffer = 2 M
Write_buffer = 2 M

[Mysqlhotcopy]
Interactive-timeout
Expire_logs_days = 10

8. Start mysql

Service mysqld start

9. Modify the administrator password and test the password.

#/Usr/local/mysql/bin/mysqladmin-u root password 'admin' # Set the Administrator password
#/Usr/local/mysql/bin/mysql-u root-p # Test password input

10. Configure mysql account Security

[Root @ test ~] #/Usr/local/mysql/bin/mysql_secure_installation

NOTE: running all parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!

In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you 've just installed MySQL, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.

Enter current password for root (enter for none ):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
Root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n '.

Change the root password? [Y/n] n
... Skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
To log into MySQL without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
... Skipping.

By default, MySQL comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.

Remove test database and access to it? [Y/n] y
-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

All done! If you 've completed all of the above steps, your MySQL
Installation shoshould now be secure.

Thanks for using MySQL!

Cleaning up...

Logon test:

[Root @ test data] # mysql-uroot-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 9
Server version: 5.6.29-log Source distribution

Copyright (c) 2000,201 6, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> \ s
--------------
Mysql Ver 14.14 Distrib 5.6.29, for Linux (x86_64) using EditLine wrapper

Connection id: 9
Current database:
Current user: root @ localhost
SSL: Not in use
Current pager: stdout
Using outfile :''
Using delimiter :;
Server version: 5.6.29-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket:/tmp/mysql. sock
Uptime: 9 min 36 sec

Threads: 1 Questions: 29 Slow queries: 0 Opens: 71 Flush tables: 1 Open tables: 64 Queries per second avg: 0.050
--------------

Mysql>

Installation is complete.

This article permanently updates the link address:

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.