Late at night, the reason to write this article is really because a lot of time today wasted on this MySQL installation, originally very simple process, but almost wasted a day of time.
First, Mysql installation and startup
Preparatory work
(1) Create a user
useradd-s/sbin/nologin-m mysql
(2) Create a MySQL directory
mkdir-p/data/mysql
(3) Directory owner
chown-r Mysql/data/mysql
1. Download the latest MySQL
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/82/3E/wKiom1dPJz-T48UTAAE9Eth5r90711.jpg-wh_500x0-wm_3 -wmp_4-s_1132967609.jpg "title=" qq20160602021923.jpg "alt=" Wkiom1dpjz-t48utaae9eth5r90711.jpg-wh_50 "/>
2. File transfer to CentOS/usr/local/src/
3. Unzip MySQL, move
TAR-ZXVF mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
MV Mysql-5.7.12-linux-glibc2.5-x86_64/usr/local/mysql
4. Configuration files and replication of startup files
cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
5. Modify the configuration file
vim/etc/my.cnf
Basedir =/usr/local/mysql
DataDir =/data/mysql
6. Start MySQL
/etc/init.d/mysqld start
Ii. problems that may be encountered
starting MySQL... ERROR! theserver quit without updatingPIDfile ...
(1) The /etc/my.cnf configuration file may be used when MySQL does not specify a configuration file.
cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Please open this file to see if there is a specified data directory (DATADIR) under [mysqld ].
WORKAROUND: Please set this line under [mysqld]: DataDir =/data/mysql
(2) may be/data/mysql data directory MySQL user does not have permission
chown-r Mysql/data/mysql
Centos 6.7 Installation MySQL 5.7.12