MySQL official website: http://dev.mysql.com/downloads/
Linux environment: Newly installed 32-bit "Minimal Installation" CentOS 6.7
MySQL version: This experiment is installed mysql5.1, based on 32-bit operating system, this download is a binary-free compiler package. Installation environment for 32-bit CentOS 6.7
Sohu Open Source Mirror site: http://mirrors.sohu.com/, go here to download the MySQL source package.
one. Install MySQL
[Email protected] ~]# cd/usr/local/src/[[email protected] src]# wget HTTP://MIRRORS.SOHU.COM/MYSQL/MYSQL-5.1/ Mysql-5.1.73-linux-i686-glibc23.tar.gz[[email protected] src]# mv mysql-5.1.73-linux-i686-glibc23/usr/local/mysql/
Note: We install MySQL in the/usr/local/mysql/directory
Two. Create a MySQL user and initialize the database
Note: 1. The created MySQL user cannot log in to the terminal and does not create a home directory
2.mkdir parameter-p indicates cascading creation
3. Change the genus of the/data/mysql directory to MySQL
4.MYSQL_INSTALL_DB is used to initialize the database,--the owner of the user definition database,--datadir defines where the database is installed. (If two OK indicates success of initialization)
Three. Copy the configuration file my.cnf and startup script mysqld
Copy the configuration file and modify it:
[[Email protected] mysql]# CD Support-files/[[email protected] support-files]# CP my-large.cnf/etc/my.cnf
[Email protected] support-files]# VIM/ETC/MY.CNF
and comment out the two configuration lines of "Log-bin=mysql-bin" and "binlog_format=mixed" in my.cnf
Copy the startup script and modify:
[email protected] support-files]# CP mysql.server/etc/init.d/mysqld
[Email protected] support-files]# chmod 755/etc/init.d/mysqld
[Email protected] support-files]# Vim/etc/init.d/mysqld
Locate the two configuration lines "basedir=" and "datadir=" and Change to "Basedir=/usr/local/mysql" and "Datadir=/data/mysql"
Note: In the 1.mysqld script file, basedir specifies where our MySQL program is placed,
The 2.mysqld script file datadir Specifies the data MySQL we define.
Four. Add MySQL to the system service and start
[[email protected] support-files]# chkconfig--add mysqld[[email protected] support-files]# chkconfig mysqld on[[email PR Otected] support-files]#/etc/init.d/mysqld startstarting MySQL [OK]
Note: Chkconfig is a variety of services to check and set up the system
Five. mysql configuration file explained
Current/ETC/MY.CNF file contents:
#my.cnf[Client]port= 3306Socket=/tmp/Mysql.sock#The MySQL server[Mysqld]port= 3306#Portsocket=/tmp/mysql.sock#Socket for monitoringSkip-locking#do you want to filter out lockKey_buffer_size = 256M#User index block buffer, increase it to get better index processing speedMax_allowed_packet = 1M#allow the largest packageTable_open_cache = 256#the number of open tables for all threadsSort_buffer_size = 1M#sort of buffer memory size (one thread)Read_buffer_size = 1M#Read the bufferRead_rnd_buffer_size = 4M#random-Read buffersMyisam_sort_buffer_size = 64M#For the MyISAM engine ,Thread_cache_size = 8#Cache reusable limits, which are related to the number of CPU coresQuery_cache_size= 16M#Query CacheThread_concurrency = 8#Number of CPU cores, max concurrent Threadslog-bin=mysql-bin Binlog_format=Mixedserver-id= 1[Mysqldump]quickmax_allowed_packet=16m[mysql]no-auto-rehash[myisamchk]key_buffer_size=128msort_buffer_size=128mread_buffer=2mwrite_buffer=2m[mysqlhotcopy]interactive-timeout
;
001.mysql installation (LNMP)