MySQL source mode installation with full uninstall MySQL

Source: Internet
Author: User
Tags install perl

1. Introduction to Basic Environment 1.1 software environment

Operating system: Redhat Linux 6.3

MySQL version: MySQL 5.6.24

1.2 Disk directory Planning

Serial number

Directory

Use

1

/opt/mysql/mysql-5.6.24

MySQL Main program installation directory

2

/data/mysql/mysql_5624/{data,tmp,logs}

Store data files, temporary files, log files, 5624 for 5.6.24 Version number

2, Linux Environment Tuning Optimization 2.1 Turn off NUMA

Edit the/etc/grub.conf file and add numa=offelevator=deadline after kernel

2.2 Turn off SELinux

Edit the/etc/selinux/config file and add selinux=disabled to the last face

2.3 Modifying the Unlimit parameter

To edit the/etc/security/limits.conf file, add the following four lines of information:

Root Soft Nofile 65535

Root Hard Nofile 65535

Root Soft Nproc 7000

Root Hard Nproc 7000

2.4 Close Iptables

#service iptables Stop

#/etc/init.d/iptables stop

#chkconfig iptables off

2.5 Modifying environment variables

#Vi. Bash_profile

Add the following content:

Export Path=/usr/local/mysql/bin:/opt/mysql/mysql-5.6.24/bin: $HOME/bin: $PATH

#source. Bash_profile

Due to the large number of modifications, it is recommended to restart Linux once, and verify that the configuration of the parameters is in effect.

3, install mysql3.1 create the installation and storage data files and other files directory

#mkdir –p/opt/mysql/mysql-5.6.24

#mkdir –p/data/mysql/mysql_5624/{data,tmp,logs}

3.2 Creating a MySQL user and user group

# Groupadd MySQL

# useradd-g mysql-s/sbin/nologin-d/opt/mysql MySQL

3.3 The DBD module package that requires MySQL installation

The DBD module package is named: perl-dbd-mysql-3.0007-2.el5.x86_64.rpm

#yum Install CMake *gcc* libaio libaio-devel automake autoconf bzbison libtool ncurses

#yum Install Perl-dbd-mysql

For the configuration of Yum, please refer to the author published in the blog "oracle_linux_6_64 (bit) installed ORACLE11GR2 database environment Quick Preparation Artifact Oracle-rdbms-server-11gr2-preinstall" In the 3rd Chapter: "To build a local yum server for use of Oracle-rdbms-server-11gr2-preinstall", blog post URL: http://blog.csdn.net/ljunjie82/article/details/37373595

3.4 Download the source installation package

Http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz

3.5 Uploading compressed files to the server

Upload the downloaded mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz source installation file to the server's/opt/mysql/directory (method slightly)

3.6 Unpacking the MySQL installation package

#tar-xzvf/opt/mysql/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz-c/opt/mysql/mysql-5.6.24/

3.7 Cut the extracted files to the planned installation directory

#cd/opt/mysql/mysql-5.6.24

#mv mysql-5.6.24-linux-glibc2.5-x86_64/*.

#rm –RF mysql-5.6.24-linux-glibc2.5-x86_64

3.8 Creating ln Soft Links

Purpose of creating a soft link: In order to have multiple MySQL versions on the server, flexible links can be used to point to the version you want to use, which is most useful when upgrading.

#ln-S/opt/mysql/mysql-5.6.24/usr/local/mysql

3.9 Changing directory Permissions

#chown-R Mysql:mysql/usr/local/mysql

#chown-R Mysql:mysql/data/mysql

#chown-R Mysql:mysql/opt/mysql

3.10 See if the dependent Lib library is secure

#ldd/usr/local/mysql/bin/mysqld

4, configuration my.cnf parameters and database initialization 4.1 configuration MY.CNF Parameters

(1) Backup/etc/my.cnf

#mv/etc/my.cnf/etc/my.cnf_backup

(2) Create a new/etc/my.cnf file

#vi/etc/my.cnf

[Client]

Port = 3306

Socket =/tmp/mysql.sock

[MySQL]

Prompt=[master]>

#pager = "Less-i-n-s"

Tee=/data/mysql/mysql_5624/data/query.log

No-auto-rehash

[Mysqld_multi]

Mysqld =/usr/local/mysql/bin/mysqld_safe

Mysqladmin =/usr/local/mysql/bin/mysqladmin

Log =/opt/mysql/mysqld_multi.log

[Mysqld]

#misc

Explicit_defaults_for_timestamp = ture

user = MySQL

Basedir =/usr/local/mysql

DataDir =/data/mysql/mysql_5624/data

Port = 3306

Socket =/tmp/mysql.sock

Event_scheduler = 0

#timeout

Interactive_timeout = 300

Wait_timeout = 300

#character Set

Character-set-server = UTF8

Open_files_limit = 65535

max_connections = 100

Max_connect_errors = 100000

Skip-name-resolve = 1

#logs

Log-output=file

Slow_query_log = 1

Slow_query_log_file = Slow.log

Log-error =/data/mysql/mysql_5624/data/error.log

Log_warnings = 2

Pid-file = Mysql.pid

Long_query_time = 1

#log-slow-admin-statements = 1

#log-queries-not-using-indexes = 1

Log-slow-slave-statements = 1

#binlog

Binlog_format = Mixed

Server-id = 2003306

Log-bin =/data/mysql/mysql_5624/logs/mybinlog

Binlog_cache_size = 4M

Max_binlog_size = 1G

Max_binlog_cache_size = 2G

Sync_binlog = 0

Expire_logs_days = 10

#relay Log

Skip_slave_start = 1

Max_relay_log_size = 1G

Relay_log_purge = 1

Relay_log_recovery = 1

Log_slave_updates

#slave-skip-errors=1032,1053,1062

#buffers & Cache

Table_open_cache = 2048

Table_definition_cache = 2048

Table_open_cache = 2048

Max_heap_table_size = 96M

Sort_buffer_size = 2M

Join_buffer_size = 2M

Thread_cache_size = 256

Query_cache_size = 0

Query_cache_type = 0

Query_cache_limit = 256K

Query_cache_min_res_unit = 512

Thread_stack = 192K

Tmp_table_size = 96M

Key_buffer_size = 8M

Read_buffer_size = 2M

Read_rnd_buffer_size = 16M

Bulk_insert_buffer_size = 32M

#myisam

Myisam_sort_buffer_size = 128M

Myisam_max_sort_file_size = 10G

Myisam_repair_threads = 1

#innodb

Innodb_buffer_pool_size = 100M

Innodb_buffer_pool_instances = 1

Innodb_data_file_path = Ibdata1:1g:autoextend

Innodb_flush_log_at_trx_commit = 1

Innodb_log_buffer_size = 64M

Innodb_log_file_size = 256M

Innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 50

innodb_file_per_table = 1

Innodb_rollback_on_timeout

Innodb_status_file = 1

innodb_io_capacity = 2000

Transaction_isolation = read-committed

Innodb_flush_method = O_direct

#端口号为3306的实例特殊配置

[mysqld3306]

Port = 3306

#指定本实例相应版本的basedir和datadir

Basedir=/usr/local/mysql

DataDir =/data/mysql/mysql_5624/data

Socket =/tmp/mysql_5624.sock

#重新配置这几个选项, not as a global configuration, overrides the global settings above directly

Innodb_buffer_pool_size = 100m

Transaction_isolation = Repeatable-read

##### #以下为多个版本mysql时的相关备用参数 #####

#[mysqldxxxx]

#port =3308

#basedir =/usr/local/mysql

#datadir =/data/mysql/mysql_xxxx/data

#socket =/tmp/mysql_xxxx.sock

#重新配置这几个选项, not as a global configuration, overrides the global settings above directly

#innodb_buffer_pool_size = 100m

#innodb_flush_log_at_trx_commit = 2

#sync_binlog = 0

4.2 Initializing MySQL

Special Note: Initializing the database must be done in the Basedir directory

#cd/usr/local/mysql

#./scripts/mysql_install_db--user=mysql--defaults-file=/etc/my.cnf

#./scripts/mysql_install_db--datadir=/data/mysql/mysql_5624/data--defaults-file=/etc/my.cnf

5. Start and close mysql5.1 start MySQL

(1) MySQL

#/etc/init.d/mysql start

Starting MySQL ... success!

(2) Verify that MySQL is running

#ps Axu |grep mysqld

Root 3329 0.1 0.0 106272 1412 pts/0 S 08:27 0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/ Mysql/mysql_5624/data--pid-file=/data/mysql/mysql_5624/data/mysql.pid

MySQL 4267 3.6 29.6 1121464 565388 pts/0 Sl 08:27 0:01/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql-- Datadir=/data/mysql/mysql_5624/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql /mysql_5624/data/error.log--open-files-limit=65535--pid-file=/data/mysql/mysql_5624/data/mysql.pid--socket=/ Tmp/mysql.sock--port=3306

(3) Verify that the configured port 3306 is monitored

#netstat-nalp|grep "3306"

TCP 0 0::: 3306:::* LISTEN 4267/mysqld

5.2 Turn off MySQL

#mysqladmin-uroot shutdown

6. Completely uninstall MySQL

(1) Query the MySQL package that has already been installed

#rpm –qa|grep MySQL

(2) Full uninstall with Yum

# yum remove MySQL mysql-server mysql-libsmysql-connector

(3) Manually delete the created directory and the my.cnf file

#rm –rf/opt/mysql

#rm –rf/data/mysql

#rm/etc/my.cnf

(4) Manually delete the created soft links

#cd/usr/local

#rm MySQL

This article Li Junjie (Network Name: casing), engaged in "system architecture, operating systems, storage devices, databases, middleware, applications" six levels of systematic performance optimization work

Welcome to the System performance Optimization Professional group, to discuss performance optimization technology together. Group number: 258187244

MySQL source mode installation with full uninstall MySQL

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.