MySQL 5.6 for REHL 6.4编译安装

来源:互联网 时间:2017-07-27

    MySQL安装方式有多种,可以使用rpm包二进制安装,也可以使用源码进行编译安装。很显然,编译安装的好处很多,就是能够对将要使用的MySQL数据库进行定制,

对于特定的操作系统、特定的应用、特定的MySQL功能要求很适合。因此,这里记录一次MySQL 5.6 for REHL 6.4编译安装过程。

1、操作系统信息检查并卸载操作系统自带的过低版本Mysql

[[email protected] ~]# uname -a
Linux arbiter 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[[email protected] ~]# 

[[email protected] ~]# cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
#::1            localhost6.localdomain6 localhost6

192.168.144.111 arbiter
[[email protected] ~]# 

[[email protected] cmake-2.8.10.2]# rpm -qa|grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[[email protected] cmake-2.8.10.2]# rpm -e --nodeps mysql-libs
[[email protected] cmake-2.8.10.2]# rpm -qa|grep mysql

[[email protected] cmake-2.8.10.2]#

2、检查MySQL编译安装必须的操作系统依赖包

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})/n' make /
gcc-c++ /
libstdc++-devel /
ncurses-devel 

[[email protected] ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})/n' make /
> gcc-c++ /
> libstdc++-devel /
> ncurses-devel 
make-3.81-20.el6 (x86_64)
package gcc-c++ is not installed
package libstdc++-devel is not installed
package ncurses-devel is not installed
[[email protected] ~]# 

3、安装MySQL编译安装必须的操作系统依赖包

--挂载系统镜像配置本地的yum源

[[email protected] ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

[root[email protected] yum.repos.d]# cat local.repo 
[local]
name = local
baseurl=file:///mnt/
enabled = 1
gpgcheck = 0
gpgkey =file://mnt/RPM-GPG-KEY-CentOS-6
[[email protected] yum.repos.d]# 

[[email protected] yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: InstallMedia base extras local updates
Cleaning up Everything
[[email protected] yum.repos.d]# 

--使用yum安装操作系统缺少的rpm包

yum -y install gcc-c++

ncurses-devel  ncurses-devel 

4、上传、解压并安装cmake

[[email protected] ~]# ls
anaconda-ks.cfg  cmake-2.8.10.2.tar  Documents  install.log         Music     pkg     rpms       test
Desktop             Downloads  install.log.syslog  Pictures  Public  Templates  Videos
[[email protected] ~]# tar -xvf cmake-2.8.10.2.tar 

--安装cmake

[[email protected] cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[[email protected] cmake-2.8.10.2]# ./configure......-- Performing Test run_pic_test
-- Performing Test run_pic_test - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /root/cmake-2.8.10.2
---------------------------------------------
CMake has bootstrapped.  Now run gmake.
[[email protected] cmake-2.8.10.2]# 
[[email protected] cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[[email protected] cmake-2.8.10.2]# gmake

......

[ 99%] Built target foo
Scanning dependencies of target memcheck_fail
[100%] Building C object Tests/CTestTestMemcheck/CMakeFiles/memcheck_fail.dir/ret1.c.o
Linking C executable memcheck_fail
[100%] Built target memcheck_fail
Scanning dependencies of target pseudo_BC
[100%] Building C object Tests/CTestTestMemcheck/CMakeFiles/pseudo_BC.dir/ret0.c.o
Linking C executable BC
[100%] Built target pseudo_BC
Scanning dependencies of target pseudo_purify
[100%] Building C object Tests/CTestTestMemcheck/CMakeFiles/pseudo_purify.dir/ret0.c.o
Linking C executable purify
[100%] Built target pseudo_purify
Scanning dependencies of target pseudo_valgrind
[100%] Building C object Tests/CTestTestMemcheck/CMakeFiles/pseudo_valgrind.dir/ret0.c.o
Linking C executable valgrind
[100%] Built target pseudo_valgrind
[[email protected] cmake-2.8.10.2]#

[[email protected] cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[[email protected] cmake-2.8.10.2]# gmake install

......

-- Installing: /usr/local/doc/cmake-2.8/cpack.docbook
-- Installing: /usr/local/doc/cmake-2.8/ccmake.docbook
-- Installing: /usr/local/share/aclocal/cmake.m4
-- Installing: /usr/local/share/cmake-2.8/editors/vim/cmake-help.vim
-- Installing: /usr/local/share/cmake-2.8/editors/vim/cmake-indent.vim
-- Installing: /usr/local/share/cmake-2.8/editors/vim/cmake-syntax.vim
-- Installing: /usr/local/share/cmake-2.8/editors/emacs/cmake-mode.el
-- Installing: /usr/local/share/cmake-2.8/completions/cmake
-- Installing: /usr/local/share/cmake-2.8/completions/cpack
-- Installing: /usr/local/share/cmake-2.8/completions/ctest
[[email protected] cmake-2.8.10.2]# 

5、创建mysql用户

groupadd -g 20000 mysqluseradd -u 20000 -g mysql mysql[[email protected] ~]# groupadd -g 20000 mysql
[[email protected] ~]# useradd -u 20000 -g mysql mysql
6、创建mysql安装目录并授权mkdir -p /application/mysql-5.6mkdir -p /application/mysql-5.6/data
mkdir -p /application/mysql-5.6/log
mkdir -p /application/mysql-5.6/tmp
chown -R mysql:mysql /application/chown -R mysql:mysql /application/mysql-5.6/tmp/
chown -R mysql:mysql /application/mysql-5.6/log/
chmod 775 /application/mysql-5.6/log/
chmod 1771 /application/mysql-5.6/tmp/
chown -R 775 /application/chmod 1777 /tmp
7、上传解压MySQL并编译安装[[email protected] ~]# ls
anaconda-ks.cfg  cmake-2.8.10.2.tar  Documents  install.log         Music                Pictures  Public  Templates  Videos
cmake-2.8.10.2   Desktop             Downloads  install.log.syslog  mysql-5.6.36.tar.gz  pkg       rpms    test
[[email protected] ~]#
[[email protected] ~]# gunzip mysql-5.6.36.tar.gz 
[[email protected] ~]# ls
anaconda-ks.cfg  cmake-2.8.10.2.tar  Documents  install.log         Music             Pictures  Public  Templates  Videos
cmake-2.8.10.2   Desktop             Downloads  install.log.syslog  mysql-5.6.36.tar  pkg       rpms    test
[[email protected] ~]# tar -xvf mysql-5.6.36.tar 
[[email protected] ~]# ls
anaconda-ks.cfg  cmake-2.8.10.2.tar  Documents  install.log         Music         mysql-5.6.36.tar  pkg     rpms       test
cmake-2.8.10.2   Desktop             Downloads  install.log.syslog  mysql-5.6.36  Pictures          Public  Templates  Videos
[[email protected] ~]# 
--设置mysql的环境变量echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile |tail -l /etc/profilesource /etc/profileecho $PATH[[email protected] ~]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile |
> tail -l /etc/profile
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null 2>&1
        fi
    fi
done
unset i
unset -f pathmunge
[[email protected] ~]# source /etc/profile
[[email protected] ~]# echo $PATH
/application/mysql/bin:/opt/mongo/mongosoft/bin:/home/mongo/Documents/maven/bin:/usr/java/jdk1.8.0_11/bin/:/opt/mongo/ycsb/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[[email protected] ~]# 
--编译MySQL,检查cmake[[email protected] ~]#  ls -l /usr/local/bin/cmake
-rwxr-xr-x 1 root root 9188179 Jul 27 00:10 /usr/local/bin/cmake
[[email protected] ~]# 
--编译MySQL源码cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6 /-DMYSQL_DATADIR=/application/mysql-5.6/data /-DMYSQL_UNIX_ADDR=/application/mysql-5.6/tmp/mysql.sock /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_general_ci /-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii /-DENABLED_LOCAL_INFILE=ON /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_FEDERATED_STORAGE_ENGINE=1 /-DWITH_BLACKHOLE_STORAGE_ENGINE=1 /-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 /-DWITHOUT_PARTITION_STORAGE_ENGINE=0 /-DWITH_FAST_MUTEXES=1 /-DWITH_ZLIB=bundled /-DENABLED_LOCAL_INFILE=1 /-DWITH_READLINE=1 /-DWITH_EMBEDDED_SERVER=1 /-DWITH_DEBUG=0 /-DMYSQL_TCP_PORT=3306[[email protected] mysql-5.6.36]# cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6  /
> -DMYSQL_DATADIR=/application/mysql-5.6/data  /
> -DMYSQL_UNIX_ADDR=/application/mysql-5.6/tmp/mysql.sock  /
> -DDEFAULT_CHARSET=utf8  /
> -DDEFAULT_COLLATION=utf8_general_ci  /
> -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii  /
> -DENABLED_LOCAL_INFILE=ON /
> -DWITH_INNOBASE_STORAGE_ENGINE=1  /
> -DWITH_FEDERATED_STORAGE_ENGINE=1  /
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1  /
> -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1  /
> -DWITHOUT_PARTITION_STORAGE_ENGINE=0  /
> -DWITH_FAST_MUTEXES=1  /
> -DWITH_ZLIB=bundled  /
> -DENABLED_LOCAL_INFILE=1  /
> -DWITH_READLINE=1  /
> -DWITH_EMBEDDED_SERVER=1  /
> -DWITH_DEBUG=0 /
> -DMYSQL_TCP_PORT=3306
......-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- Skipping deb packaging on unsupported platform .
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:
    WITH_READLINE
-- Build files have been written to: /root/mysql-5.6.36
[[email protected] mysql-5.6.36]#
--编译安装mysql,此阶段耗时比较长,需耐心等待[[email protected] mysql-5.6.36]#make && make install......-- Installing: /application/mysql-5.6/sql-bench/crash-me
-- Installing: /application/mysql-5.6/sql-bench/README
-- Installing: /application/mysql-5.6/sql-bench/test-big-tables
-- Installing: /application/mysql-5.6/sql-bench/innotest2
-- Installing: /application/mysql-5.6/sql-bench/run-all-tests
-- Installing: /application/mysql-5.6/sql-bench/test-connect
-- Installing: /application/mysql-5.6/sql-bench/test-alter-table
-- Installing: /application/mysql-5.6/sql-bench/test-wisconsin
[[email protected] mysql-5.6.36]# --制作软连接ln -s /application/mysql-5.6 /application/mysql[[email protected] mysql-5.6.36]# ln -s /application/mysql-5.6 /application/mysql
[[email protected] mysql-5.6.36]# 
--创建并编辑mysql的控制文件[[email protected] ~]# vi /etc/my.cnf
[[email protected] ~]# cat /etc/my.cnf 
[mysqld]
datadir=/application/mysql-5.6/data
socket=/application/mysql-5.6/tmp/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/application/mysql-5.6/log/mysqld.log
pid-file=/application/mysql-5.6/run/mysqld/mysqld.pid
[[email protected] ~]# 
--初始化mysql数据库[[email protected] ~]# cd /application/mysql
[[email protected] mysql]# cd scripts/
[[email protected] scripts]# ls
mysql_install_db
[[email protected] scripts]# pwd
/application/mysql/scripts
[[email protected] scripts]# ls
mysql_install_db
[[email protected] scripts]# ./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
Installing MySQL system tables...2017-07-27 00:53:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-27 00:53:16 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-07-27 00:53:16 0 [Note] /application/mysql/bin/mysqld (mysqld 5.6.36) starting as process 27357 ...
2017-07-27 00:53:16 27357 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-27 00:53:16 27357 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-27 00:53:16 27357 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-27 00:53:16 27357 [Note] InnoDB: Memory barrier is not used
2017-07-27 00:53:16 27357 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-27 00:53:16 27357 [Note] InnoDB: Using CPU crc32 instructions
2017-07-27 00:53:16 27357 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-07-27 00:53:16 27357 [Note] InnoDB: Completed initialization of buffer pool
2017-07-27 00:53:16 27357 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-07-27 00:53:16 27357 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-07-27 00:53:16 27357 [Note] InnoDB: Database physically writes the file full: wait...
2017-07-27 00:53:16 27357 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-07-27 00:53:16 27357 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-07-27 00:53:16 27357 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-07-27 00:53:16 27357 [Warning] InnoDB: New log files created, LSN=45781
2017-07-27 00:53:16 27357 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-07-27 00:53:16 27357 [Note] InnoDB: Doublewrite buffer created
2017-07-27 00:53:16 27357 [Note] InnoDB: 128 rollback segment(s) are active.
2017-07-27 00:53:16 27357 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-27 00:53:16 27357 [Note] InnoDB: Foreign key constraint system tables created
2017-07-27 00:53:16 27357 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-07-27 00:53:16 27357 [Note] InnoDB: Tablespace and datafile system tables created.
2017-07-27 00:53:16 27357 [Note] InnoDB: Waiting for purge to start
2017-07-27 00:53:16 27357 [Note] InnoDB: 5.6.36 started; log sequence number 0
2017-07-27 00:53:17 27357 [Note] Binlog end
2017-07-27 00:53:17 27357 [Note] InnoDB: FTS optimize thread exiting.
2017-07-27 00:53:17 27357 [Note] InnoDB: Starting shutdown...
2017-07-27 00:53:18 27357 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2017-07-27 00:53:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-27 00:53:18 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-07-27 00:53:18 0 [Note] /application/mysql/bin/mysqld (mysqld 5.6.36) starting as process 27379 ...
2017-07-27 00:53:18 27379 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-27 00:53:18 27379 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-27 00:53:18 27379 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-27 00:53:18 27379 [Note] InnoDB: Memory barrier is not used
2017-07-27 00:53:18 27379 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-27 00:53:18 27379 [Note] InnoDB: Using CPU crc32 instructions
2017-07-27 00:53:18 27379 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-07-27 00:53:18 27379 [Note] InnoDB: Completed initialization of buffer pool
2017-07-27 00:53:18 27379 [Note] InnoDB: Highest supported file format is Barracuda.
2017-07-27 00:53:18 27379 [Note] InnoDB: 128 rollback segment(s) are active.
2017-07-27 00:53:18 27379 [Note] InnoDB: Waiting for purge to start
2017-07-27 00:53:18 27379 [Note] InnoDB: 5.6.36 started; log sequence number 1625977
2017-07-27 00:53:18 27379 [Note] Binlog end
2017-07-27 00:53:18 27379 [Note] InnoDB: FTS optimize thread exiting.
2017-07-27 00:53:18 27379 [Note] InnoDB: Starting shutdown...
2017-07-27 00:53:19 27379 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
  /application/mysql/bin/mysqladmin -u root password 'new-password'
  /application/mysql/bin/mysqladmin -u root -h arbiter password 'new-password'
Alternatively you can run:
  /application/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
  cd . ; /application/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
  cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
  http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /application/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
[[email protected] scripts]# 
--创建mysqld并启动mysql数据库

[[email protected] support-files]# ls
binary-configure  magic  my-default.cnf  mysqld_multi.server  mysql-log-rotate  mysql.server
[[email protected] support-files]# pwd
/application/mysql/support-files
[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld
[[email protected] support-files]# chmod +x /etc/init.d/mysqld 
[[email protected] support-files]# 

[[email protected] log]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS! 
[[email protected] log]# 

--登录mysql

[[email protected] log]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 1
Server version: 5.6.36 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> 

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

mysql> 

接下来就可以对mysql进行业务数据库的安全、数据等的初始化了!!!


启动异常一、socket文件相关:

[[email protected] log]# cat mysqld.log 
2017-07-27 01:06:19 28474 [Note] Plugin 'FEDERATED' is disabled.
2017-07-27 01:06:19 28474 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-27 01:06:19 28474 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-27 01:06:19 28474 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-27 01:06:19 28474 [Note] InnoDB: Memory barrier is not used
2017-07-27 01:06:19 28474 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-27 01:06:19 28474 [Note] InnoDB: Using CPU crc32 instructions
2017-07-27 01:06:19 28474 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-07-27 01:06:19 28474 [Note] InnoDB: Completed initialization of buffer pool
2017-07-27 01:06:19 28474 [Note] InnoDB: Highest supported file format is Barracuda.
2017-07-27 01:06:19 28474 [Note] InnoDB: 128 rollback segment(s) are active.
2017-07-27 01:06:19 28474 [Note] InnoDB: Waiting for purge to start
2017-07-27 01:06:19 28474 [Note] InnoDB: 5.6.36 started; log sequence number 1626027
2017-07-27 01:06:19 28474 [Note] Server hostname (bind-address): '*'; port: 3306
2017-07-27 01:06:19 28474 [Note] IPv6 is available.
2017-07-27 01:06:19 28474 [Note]   - '::' resolves to '::';
2017-07-27 01:06:19 28474 [Note] Server socket created on IP: '::'.
2017-07-27 01:06:19 28474 [ERROR] Can't start server : Bind on unix socket: Permission denied
2017-07-27 01:06:19 28474 [ERROR] Do you already have another mysqld server running on socket: /application/mysql-5.6/tmp/mysql.sock ?
2017-07-27 01:06:19 28474 [ERROR] Aborting

原因是:my.cnf配置中mysql.sock文件存放目录或权限有问题

解决方法:检查socket配置的路径是否存在,socket指定的路径下mysql用户是否有读写权限

mkdir -p /application/mysql-5.6/tmpchown -R mysql:mysql /application/mysql-5.6/tmp/chmod 1771 /application/mysql-5.6/tmp/启动异常二、日志相关

[[email protected] ]# /etc/init.d/mysqld start
Starting MySQL.170727 00:56:52 mysqld_safe error: log-error set to '/application/mysql-5.6/log/mysqld.log', however file don't exists.Create writable for user 'mysql'.
 ERROR!
The server quit without updating PID file (/application/mysql-5.6/data/arbiter.pid).
[[email protected] ]#

原因是:my.cnf配置的log目录不存在或mysql用户对其没有读写权限

解决方法:检查相关路径是否存在并创建授权

mkdir -p /application/mysql-5.6/logchown -R mysql:mysql /application/mysql-5.6/log/
chmod 775 /application/mysql-5.6/log/


相关阅读:
Top