MySQL installation is generally divided into three types, source installation, binary installation, RPM installation, this article mainly introduces the binary installation.
Download MySQL communicity server5.5.39 version from the MySQL official website first, the platform is linux-generic.
Pre-preparation work 1 and 2
1. Close Iptables
Chkconfig iptables off (permanently off)
Serviceiptables stop
2. Turn off SELinux
Vi/etc/sysconfig/selinux
Selinux=disabled
Reboot
3 Create a MySQL user group, a MySQL user group
Groupadd MySQL
Useradd-g mysql-s/sbin/nologin-d/opt/mysql MySQL
Check the user
#id MySQL
uid=500 (MySQL) gid=500 (MySQL) groups=500 (MySQL)
4 Extracting binary
cd/opt/mysql/
Tar zxvf mysql-5.5.39-linux2.6-x86_64.tar.gz
5 Creating related directories and related files
Main ideas
/data/mysql/mysql_3306/{data, logs,tmp}
/etc/my.cnf
/usr/local/mysql-> the file you just unzipped (--)
Specific steps
[Email protected] mysql]# cd/usr/local/
[[email protected] local]# ln-s/opt/mysql/mysql-5.5.39-linux2.6-x86_64 MySQL
[[email protected] local]# ls-l MySQL
lrwxrwxrwx 1 root root 20:56 mysql->/opt/mysql/mysql-5.5.39-linux2.6-x86_64
Cd/data
mkdir MySQL
[Email protected] mysql]# mkdir mysql_3306
[Email protected] mysql]# CD mysql_3306/
[Email protected] mysql_3306]# mkdir data
[Email protected] mysql_3306]# mkdir logs
[Email protected] mysql_3306]# mkdir tmp
6 Changing permissions
Chown-r mysql:mysql/data/mysql/
Chown-r mysql:mysql/usr/local/mysql/
7 Add environment variable to solve the problem of unable to find MySQL command
Vi/etc/profile
Export path= $PATH:/usr/local/mysql/bin
Source/etc/profile
8 Is it safe to rely on Lib libraries?
# Ldd/usr/local/mysql/bin/mysqld
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4A/16/wKioL1QiQ2-CLuAlAAFutg34cco258.jpg "title=" 2.png " alt= "Wkiol1qiq2-clualaafutg34cco258.jpg"/>
9 Configuration file Modification
wget http://imysql.com/wp-content/uploads/2014/08/my.cnf-sample.txt
MV MY.CNF-SAMPLE.TXT/ETC/MY.CNF
DataDir =/home/mysql–>datadir =/data/mysql/mysql_3306/data
Socket =/tmp/mysql.sock
:%s/home\/mysql/data\/mysql\/mysql_3306\/data/g
Innodb_buffer_pool_size = 1G-Innodb_buffer_pool_size = 100M
Innodb_log_files_in_group = 2, Innodb_log_files_in_group = 3
10 Initializing a database
cd/usr/local/mysql/
Initializing the database must be done under Basedir
./scripts/mysql_install_db--user=mysql--DEFAULTS-FILE=/ETC/MY.CNF
If an error occurs
Experience Summary: Initialization, start-up attention to error log
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4A/15/wKiom1QiUZORxXDoAAJmklveiBU962.jpg "title=" 3.png " alt= "Wkiom1qiuzorxxdoaajmklveibu962.jpg"/>
11 Starting MySQL
CP Support-files/mysql.server/etc/init.d/mysql
Start:
/etc/init.d/mysql start
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4A/15/wKiom1QiU1zzSh1EAACLKmAuNsQ169.jpg "title=" 6.png " alt= "Wkiom1qiu1zzsh1eaaclkmaunsq169.jpg"/>
The following error occurred:
Socket =/tmp/mysql.sock
MySQL Log in some errors
Vi/etc/my.cnf
Socket=/tmp/my.sock
13 See if our MySQL process is present and listening to the port
# PS Axu|grep mysqld
# Netstat-nalp | grep "3306"
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
2689/mysqld
14 viewing user and host addresses
[Email protected] Sat Sep 16:21:09 16:21:09 [(None)]>select User,host,password from Mysql.user;
+------+---------------------+----------+
| user | Host | password |
+------+---------------------+----------+
| Root | localhost | |
| Root | Centos5.localdomain | |
| Root | 127.0.0.1 | |
| Root | :: 1 | |
| | localhost | |
| | Centos5.localdomain | |
+------+---------------------+----------+
6 rows in Set (0.00 sec)
This article is from the DBA Sky blog, so be sure to keep this source http://9425473.blog.51cto.com/9415473/1557669
MySQL binary installation