Pre-Preparation:
Yum install gcc gcc-c++ make cmake ncurses-devel bison perl #依赖包
Build Users:
Groupadd MySQL
Useradd mysql-s/sbin/nologin-m-G MySQL
To set up the installation directory:
Mkdir/data/mysql3306-pv
Chown-r MySQL. /data/mysql3306/
Download & Unzip:
Wget–c http://download.softagency.net/MySQL/Downloads/MySQL-5.5/mysql-5.5.44.tar.gz
Tar XF mysql-5.5.44.tar.gz
CD mysql-5.5.44
Compile and install:
CMake \
-dcmake_install_prefix=/data/app/mysql3306 \
-dmysql_datadir=/data/mysql3306 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dwith_partition_storage_engine=1 \
-dextra_charsets=all \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_debug=0 \
-dmysql_user=mysql \
-dmysql_unix_addr=/data/mysql3306/mysql3306.sock
Make && make install; echo $? #echo output execution results, 0 indicates success
Configuration:
Cp-arp/tmp/mysql-5.5.44/support-files/my-large.cnf/data/mysql3306/my.cnf
Chown-r MySQL. /data/mysql3306/my.cnf
Vim/data/mysql3306/my.cnf
Add the following yellow-bottom section parameters
[Mysqld]
Port = 3306
DataDir =/data/mysql3306 #数据目录
Basedir =/data/app/mysql3306 #程序目录
Socket =/data/mysql3306/mysql3306.sock
Skip-external-locking
Key_buffer_size = 256M
Max_allowed_packet = 1M
Table_open_cache = 256
Sort_buffer_size = 1M
Read_buffer_size = 1M
Read_rnd_buffer_size = 4M
Myisam_sort_buffer_size = 64M
Thread_cache_size = 8
Query_cache_size= 16M
# Try number of CPU ' s*2 for thread_concurrency
Thread_concurrency = 8
Log-bin=mysql-bin #二进制日志, for master and slave reproduction
Binlog_format=mixed #混合模式复制 (mixed-based replication,
Server-id = 1 #多服务器时, distinguish the ID of the MySQL server identity
Initialize MySQL:
cd/data/app/mysql3306/
./scripts/mysql_install_db--basedir=/data/app/mysql3306/--datadir=/data/mysql3306/--user=mysql
Add As System service:
Cp/tmp/mysql-5.5.44/support-files/my-medium.cnf/etc/my.cnf
Cp/tmp/mysql-5.5.44/support-files/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--level mysqld on
Chkconfig--list |grep MySQL #验证
Start
/etc/init.d/mysqld restart
error! MySQL server PID file could not being found! #再次restart no more errors.
Set Password to 123456
/data/app/mysql3306/bin/mysqladmin-uroot password ' 123456 '
Landing
mysql-uroot-p123456
CMake installation mysql5.5.44