MySQL series of three MySQL compilation installation

Source: Internet
Author: User

MySQL Installation:

Dedicated Package Manager Package

deb,rpm

Rpm:

RHEL (Oracle Linux), CentOS

Suse

Universal Binary Format Package

Gcc:x86,x64

Source

5.5,5.6

CMake compiling

Select GA version


Mysql-client provides clients

Mysql-devel Development and formation

Mysql-server Server-side

Mysql-shared Shared libraries

Mysql-shared-compat Compatibility Library

Mysql-test Test Components


Last read configuration with highest precedence

/etc/my.cnf

/etc/mysql/my.conf

$MYSQL _home/my.conf

/path/to/file when Defaults-extra-file=/path/to/file is specified

~/.my.conf


----------------------

User Password Modification

1.mysqladmin-u username-h HOSTNAME password ' new_password '-p

2.mysql>set password for ' USERNAME ' @ ' Host=password (' new_pass ');

3.mysql>update Mysql.user Set Password=password (' New_pass ') where condition;


Install compile mysql-5.5

1. Compiling mysql-5.5 with CMake

CMAKE specifies compilation options in a different way from make, which is implemented in the following way:

./configure = CMake.

./configure--help = CMake. LH or Ccmake.


Specifies the options that are commonly used when installing the installation path of a file:

-dcmake_install_prefix=/usr/local/mysql

-dmysql_datadir=/data/mysql

-dsysconfdir=/etc


The default compiled storage engine includes: CSV,MYISAM,MYISAMMRG and heap: To install additional storage engines, you can use a compilation option similar to the following:


-dwith_innobase_stoage_engine=1

-dwith_archive_storage_engine=1

_dwith_blackhole_storage_engine=1

-dwith_federated_storage_engine=1


To explicitly specify that a storage engine is not compiled, you can use an option similar to the following:

-dwith_<engine>_storage_engine=1

Like what:

-dwith_example_storage_engine=1

-dwith_federated_storage_engine=1

-dwith_partition_storage_engine=1


If you want to compile into other features, such as SSL, you can use a library similar to the following, or do not use a library when compiling:

-dwithout_<engine>_storage_engine=1

Like what:

-dwithout_example_storage_engine=1

-dwithout_federated_storage_engine=1

-dwithout_partition_storage_engine=1


If you want to compile into other features, such as SSL, you can use a library similar to the one below to compile or not use a library:

-dwith_readlie=1

-dwith_ssl=system

-dwith_zlib=system

-dwith_libwrap=0


Other common options:

_dmysql_tcp_port=3306

-dmysql_unix_addr=/tmp/mysql.sock

-denabled_local_infile=1

-dextra_charsets=all

-ddefault_charset=utf8

-ddefault_collation=utf8_general_ci

-dwith_debug=0

-denable_profiling=1


If you want to clean up the files generated by the previous compilation, you need to use the following command:

Make clean

RM CMakeCache.txt


2. Compiling the installation

Groupadd-r MySQL

Useradd-g mysql-r-d/data/mydata MySQL

Tar XF mysql-5.6

CD mysql-5.6

CMake. -dcmake_insall_prefix=/usr/local/mysql \

-dmysql_datadir=/mydata/data \

-DSYSCONFDIR=/ETC \

-dwith_innobase_storage_engine=1 \

-dwith_archive_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwith_readline=1 \

-dwith_ssl=system \

-dwith_zlib=system \

-dwith_libwrap=0 \

-dmysql_unix_addr=/tmp/mysql.sock \

Make

Make install


Installation:

[Email protected] ~]# yum-y groupinstall ' development tools '

[Email protected] ~]# hwclock-s

[Email protected] ~]# Tar XF mysql-5.5.28.tar.gz

[[email protected] cmake-2.8.8]#./configure && make && make install


[[email protected] ~]# FDISK/DEV/SDB Create a new partition and adjust the partition type to 8e

/DEV/SDB1 1 2610 20964793+ 8e Linux LVM

[[email protected] ~]# PARTPROBE/DEV/SDB let the system reread the partition or reboot

[Email protected] ~]# PVCREATE/DEV/SDB1

[Email protected] ~]# vgcreate MYVG/DEV/SDB1

[Email protected] ~]# lvcreate-l 10g-n mydata MYVG

[[email protected] ~]# LVS

LV VG Attr lsize Pool Origin data% Move Log cpy%sync Convert

MyData myvg-wi-a-----10.00g

[Email protected] ~]# mke2fs-j/dev/myvg/mydata

[Email protected] ~]# Mkdir/mydata

[Email protected] ~]# Vim/etc/fstab

/dev/myvg/mydata/mydata ext3 defaults 0 0

[Email protected] ~]# Mkdir/mydata/data

[[email protected] ~]# groupadd-r MySQL

[[email protected] ~]# useradd-r-g mysql-s/sbin/nologin MySQL

[Email protected] ~]# chown-r mysql.mysql/mydata/data/

[email protected] mysql-5.5.28]# yum install–y OpenSSL openssl-devel ncurses ncurses-devel

[Email protected] mysql-5.5.28]# CMake. -dcmake_insall_prefix=/usr/local/mysql \

>-dmysql_datadir=/mydata/data \

>-DSYSCONFDIR=/ETC \

>-dwith_innobase_storage_engine=1 \

>-dwith_archive_storage_engine=1 \

>-dwith_blackhole_storage_engine=1 \

>-dwith_readline=1 \

>-dwith_ssl=system \

>-dwith_zlib=system \

>-dwith_libwrap=0 \

>-dmysql_unix_addr=/tmp/mysql.sock \

[[email protected] mysql-5.5.28]# make && make install

[[email protected] local]# chown-r mysql.mysql MySQL

[Email protected] local]# chown-r mysql.mysql/mydata/

[[email protected] mysql]#./scripts/mysql_install_db--user=mysql--datadir=/mydata/data Initialize Database

[[Email protected]ost mysql]# cp support-files/my-large.cnf/etc/my.cnf copy configuration file]

[[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld copy startup script

[Email protected] mysql]# chkconfig--add mysqld

[Email protected] mysql]# chkconfig mysqld on

[Email protected] mysql]# VIM/ETC/MY.CNF

# Try number of CPU ' s*2 for thread_concurrency

Thread_concurrency = 8

DataDir =/mydata/data


[[email protected] mysql]# vim/etc/profile.d/mysql.sh Add environment variable

Export path= $PATH:/usr/local/mysql/bin

[Email protected] mysql]#. /etc/profile.d/mysql.sh

[Email protected] mysql]# echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/ Bin


[[email protected] mysql]# MySQL

mysql> show databases; can view the database

Mysql> show engines; Viewing the storage engine

Add a password to the MySQL Admin user.


Delete the default user first:

mysql> show databases;

mysql> use MySQL;

Mysql> Show tables;

Mysql> select User,host,password from user;

+------+-----------------------+----------+

| user | Host | password |

+------+-----------------------+----------+

| Root |          localhost | |

| Root |          Localhost.localdomain | |

| Root |          127.0.0.1 | |

| Root | :: 1 |ipv6 's Account |

| |   Localhost.localdomain | Delete |

+------+-----------------------+----------+

5 rows in Set (0.00 sec)

mysql> DROP USER ' @localhost;

Query OK, 0 rows Affected (0.00 sec)


mysql> drop user ' @localhost. localdomain;

Query OK, 0 rows Affected (0.00 sec)


mysql> drop user ' root ' @ ':: 1 ';

Query OK, 0 rows Affected (0.00 sec)




mysql> Update user Set Password=password (' root ') where user= ' root ';

Query OK, 1 row affected (0.02 sec)

Rows matched:1 changed:1 warnings:0


Mysql> select User,host,password from user;

+------+---------------------------+-------------------------------------------+

| user | Host | password |

+------+---------------------------+-------------------------------------------+

| Root | Localhost.localhostdomain | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |

| Root | 127.0.0.1 | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |

| Root | localhost | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |

+------+---------------------------+-------------------------------------------+

1 row in Set (0.00 sec)


Mysql>






MySQL->mysqld

Unix:

Mysql->mysql.sock->mysqld

Windows:

Mysql->memory (pipe)->mysqld

Not on the same host, based on the TCP/IP protocol

Mysql

-uroot-h 192.168.1.50 TCP/IP protocol


Client Tools:

Mysql

Mysqldump Backup Tool

Mysqladmin Management Tools

Mysqlcheck Checking the Database integrity tool


[Client]

-U USERNAME

-H HOST

-P ' Passws '

--protocol {tcp|socket|pipe|memory}

--port Port



Non-client tools:

Myisamchk

Myisampack


MyISAM

Three files per table

. frm: Table structure

. MYD: Table Data

. MYI: Table Index


InnoDB

All tables share a table space file;

Each independent tablespace file is recommended;

. frm: Table structure

. IBD Table Space (table data and table indexes)

Mysqlimport

Mysql> Show variables like '%innodb% '; View InnoDB variables

Vim/etc/my.conf

innodb_file_per_table = 1

Service mysqld Restart


mysql> CREATE DATABASE MyDB;

Mysql> CREATE TABLE TestDB (

ID INT notnull,

-Name CHAR (30);


/mydata/data/mysql/mydb/

Db.opt test.db.frm TEST.IBD


This article from "Operation and maintenance Growth Road" blog, declined reprint!

MySQL series of three MySQL compilation installation

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.