1. 程式人生 > >mysql install on centos6.5

mysql install on centos6.5

eof files sta mit ddr ati spa sco hosts

系統:centos 6.5

軟件:mysql-5.6.36.tar.gz,libunwind-1.2.tar.gz,google-perftools-1.9.tar.gz,cmake-3.4.1.tar.gz,epel-release-6-8.noarch.rpm


[root@king01 ~]# echo "192.168.40.35 king01" >>/etc/hosts


[root@king01 ~]# rpm -ivh epel-release-6-8.noarch.rpm


[root@king01 ~]# yum install -y libaio* ncurses-devel


[root@king01 ~]# useradd mysql


[root@king01 ~]# cat >> /etc/security/limits.conf <<EOF

mysql soft nproc 2047

mysql hard nproc 16384

mysql soft nofile 1024

mysql hard nofile 65536

EOF


[root@king01 ~]# tar zxvf libunwind-1.2.tar.gz

[root@king01 ~]# cd libunwind-1.2

[root@king01 libunwind-1.2]# ./configure

[root@king01 libunwind-1.2]# make && make install


[root@king01 ~]# tar zxvf google-perftools-1.9.tar.gz

[root@king01 ~]# cd google-perftools-1.9

[root@king01 google-perftools-1.9]# ./configure

[root@king01 google-perftools-1.9]# make && make install


[root@king01 ~]# tar zxvf cmake-3.4.1.tar.gz

[root@king01 ~]# cd cmake-3.4.1

[root@king01 cmake-3.4.1]# ./configure

[root@king01 cmake-3.4.1]# gmake && make install


[root@king01 ~]# tar zxvf mysql-5.6.36.tar.gz


[root@king01 ~]# cd mysql-5.6.36


[root@king01 mysql-5.6.36]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DSYSCONFDIR=/etc \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci


[root@king01 mysql-5.6.36]# make && make install


[root@king01 ~]# /usr/local/mysql/bin/resolveip king01


[root@king01 ~]# cd mysql-5.6.36/support-files/


[root@king01 support-files]# cp mysql.server /etc/init.d/mysqld


[root@king01 support-files]# chmod a+x /etc/init.d/mysqld


[root@king01 ~]# cd /usr/local/mysql


[root@king01 mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data


[root@king01 ~]# vim /etc/profile

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


[root@king01 ~]# source /etc/profile


[root@king01 ~]# vi /usr/local/mysql/bin/mysqld_safe

export LD_PRELOAD=/usr/local/lib/libtcmalloc.so


[root@king01 ~]# service mysqld start

Starting MySQL.. [ OK ]


[root@king01 ~]# netstat -tupln |grep mysqld

tcp 0 0 :::3306 :::* LISTEN 10101/mysqld


[root@king01 ~]# lsof -n | grep tcmalloc

mysqld 10101 mysql mem REG 8,2 2212357 441654 /usr/local/lib/libtcmalloc.so.0.3.0


[root@king01 ~]# echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf

[root@king01 ~]# ldconfig


[root@king01 ~]# mysqladmin -u root password 'abcd.1234'

[root@king01 ~]# mysql -u root -pabcd.1234


mysql> show databases;

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

| Database |

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

| information_schema |

| mysql |

| performance_schema |

| test |

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

4 rows in set (0.01 sec)



mysql install on centos6.5