MySQL is the database file (storing data);
1.Download(Ape Class Forum link or official website) suitable version (official website)5.7, we learn to use5.1); A binary package that is free of compilation. The source package requires the compiler to compile into a binary file that can be supported. Note the time of the download and the number of system bits ( +bit/64the distinction of a bit)
[Email protected] ~]#cd/usr/local/src/
[[email protected] src] wgethttp://mirrors.sohu.com/mysql/mysql-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
[[email protected] src]# ls
[Email protected] src]# du-shmysql-5.1.73-linux-x86_64-glibc23.tar.gz
2. unzip the tar
[Email protected] src]# tar zxvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz
[[email protected] src]# ls
Mysql-5.1.73-linux-x86_64-glibc23 mysql-5.1.73-linux-x86_64-glibc23.tar.gz
3 , establish MySQL User
Create a run MySQL 's account No login required Don't create a home directory
[[email protected] src]# useradd-s/sbin/nologin-m MySQL
[[email protected] src]# ls/home Verification
aming Jishan MySQL user1 user2 user4 User9
4. Move and rename. Move the extracted data to the /usr/local/mysql
[[email protected] src]# MV Mysql-5.1.73-linux-x86_64-glibc23/usr/local/mysql Mobile Belt rename This directory does not exist before /USR/LOCAL/MYSQ
View MySQL file
[[email protected] src]# ls/usr/local/mysql verify /usr/local/mysql equals mysql-5.1.73-linux-x86_ 64-glibc23
Bin data include Lib Mysql-test scripts Sql-bench
COPYING docs install-binary man README share Support-files
5. initializing the database
Enter Cd/usr/local/mysql
[Email protected] src]# cd/usr/local/mysql
Create a store MySQL folder for data and change permissions
[Email protected] mysql]# mkdir-p/data/mysql
[Email protected] mysql]# chown-r mysql/data/mysql
[[email protected] mysql]# ./scripts/mysql_install_db--user=mysql--datadir=/data/mysql Initialization Complete There are two " OK". You can also use the command echo$? detected, if the output is 0 indicates success.
Installing MySQL system tables ...
Ok
Filling Help Tables ...
Ok
Note: If it is version mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz compile will error, #因为我的linux是最小化安装的, here Error missing shared library file, it's okay, we can install it. Yum Install-y Libaio
[Email protected] mysql]#/scripts/mysql_install_db--user=mysql--datadir=/dat a/mysql
Installing MySQL system tables..../bin/mysqld:errorwhile loading shared Librar Ies:libai O.so.1:cannot open Shared object file:no such file or directory
[Email protected] mysql]#/scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Installing MySQL system tables..../bin/mysqld:errorwhile Loading shared Libraries:libaio.so.1:cannot Open Shared object File:nosuch file or directory
[email protected] mysql]# Yum install-y Libaio 5.5 version Install this Yum install-y libaio*
6. Copy the configuration file and put it in the appropriate directory.
[[email protected] mysql]# CD support-files/ Place the configuration file in the appropriate directory. Configuration file storage Directory
[[email protected] support-files]# ls
Binary-configure my-huge.cnf mysqld_multi.server
Config.huge.ini my-innodb-heavy-4g.cnf Mysql-log-rotate
Config.medium.ini my-large.cnf mysql.server
Config.small.ini my-medium.cnf Ndb-config-2-node.ini
Magic my-small.cnf
[[email protected] support-files]# CP my-large.cnf/etc/my.cnf first copy my-large.cnf to etc/my.cnf and overwrite the previous configuration file
CP: Do you want to overwrite "/etc/my.cnf"? y
Note: If it is a version mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz need to perform cpmy-default.cnf/etc/my.cnf
[[email protected] support-files]# ls
Binary-configure Magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[email protected] support-files]# CP my-large.cnf/etc/my.cnf
CP: cannot get "MY-LARGE.CNF" The file status (STAT): no file or directory
-bash:syntax error near unexpected token ' ('
[email protected] support-files]# CP my-default.cnf/etc/my.cnf
CP : whether to overwrite "/ETC/MY.CNF" ? y
[Email protected] support-files]# vim my-large.cnf
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Skip-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 forthread_concurrency
Thread_concurrency = 8
# Don ' t listen on a TCP/IP port at all. This can is a security enhancement,
# If all processes this need to connect tomysqld run on the same host.
# All interaction with mysqld must is Madevia Unix sockets or Named pipes.
# Note that the using this option withoutenabling Named Pipes on Windows
# (via the "enable-named-pipe" option) would render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# Binary logging is required forreplication
# Log-bin=mysql-bin when it comes to master and slave Enter # comment before
# Binary Logging format-mixed recommended
# binlog_format=mixed
# required Unique ID between 1 and 2^32-1
# defaults to 1 if master-host are not set
# but would not function as a master ifomitted
# Server-id = 1
7. Copy the startup script. Join the System Services list and start the service.
[Email protected] support-files]# CP mysql.server/etc/init.d/mysqld
[[email protected] mysql]# chmod 755/etc/init.d/mysqld ebook on the instructions, video on the introduction of None
8 , modify the startup script
[Email protected] support-files]# vim/etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
9 , add the startup script to the system service item, and set the boot start, start MySQL
[[email protected] support-files]# chkconfig--add mysqld Join the service list
[email protected] support-files]# chkconfig mysqld on
[Email protected] support-files]#/etc/init.d/mysqld startservice mysqld Start
Starting MySQL. success!
[[email protected] support-files]# netstat-lnp |grep mysql verified Success
650) this.width=650 "width=" 642 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3418/mysqld
UNIX 2 [ACC] STREAM LISTENING 29567 3418/mysqld/tmp/mysql.sock
[Email protected] support-files]#
650) this.width=650; "Width=" 643 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>
5.6 Installation can refer to this
http://blog.csdn.net/noob_f/article/details/51399335
5.7 Practical Installation mysql-5.7.12 can refer to this
http://ask.apelearn.com/question/13004
1.1 MySQL Installation