MySQL 5.6 for REHL 6.4編譯安裝
MySQL安裝方式有多種,可以使用rpm包二進制安裝,也可以使用源碼進行編譯安裝。很顯然,編譯安裝的好處很多,就是能夠對將要使用的MySQL數據庫進行定制,
對于特定的操作系統、特定的應用、特定的MySQL功能要求很適合。因此,這里記錄一次MySQL 5.6 for REHL 6.4編譯安裝過程。
1、操作系統信息檢查并卸載操作系統自帶的過低版本Mysql
[root@arbiter ~]# 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
[root@arbiter ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[root@arbiter ~]#
[root@arbiter ~]# 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
[root@arbiter ~]#
[root@arbiter cmake-2.8.10.2]# rpm -qa|grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[root@arbiter cmake-2.8.10.2]# rpm -e --nodeps mysql-libs
[root@arbiter cmake-2.8.10.2]# rpm -qa|grep mysql
[root@arbiter cmake-2.8.10.2]#
2、檢查MySQL編譯安裝必須的操作系統依賴包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' make \
gcc-c++ \
libstdc++-devel \
ncurses-devel
[root@arbiter ~]# 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
[root@arbiter ~]#
3、安裝MySQL編譯安裝必須的操作系統依賴包
--掛載系統鏡像配置本地的yum源
[root@arbiter ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@arbiter yum.repos.d]# cat local.repo
[local]
name = local
baseurl=file:///mnt/
enabled = 1
gpgcheck = 0
gpgkey =file://mnt/RPM-GPG-KEY-CentOS-6
[root@arbiter yum.repos.d]#
[root@arbiter 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
[root@arbiter yum.repos.d]#
--使用yum安裝操作系統缺少的rpm包
yum -y install gcc-c++
ncurses-devel ncurses-devel
4、上傳、解壓并安裝cmake
[root@arbiter ~]# 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
[root@arbiter ~]# tar -xvf cmake-2.8.10.2.tar
--安裝cmake
[root@arbiter cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[root@arbiter 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.
[root@arbiter cmake-2.8.10.2]#
[root@arbiter cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[root@arbiter 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
[root@arbiter cmake-2.8.10.2]#
[root@arbiter cmake-2.8.10.2]# pwd
/root/cmake-2.8.10.2
[root@arbiter 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
[root@arbiter cmake-2.8.10.2]#
5、創建mysql用戶
groupadd -g 20000 mysql
useradd -u 20000 -g mysql mysql
[root@arbiter ~]# groupadd -g 20000 mysql
[root@arbiter ~]# useradd -u 20000 -g mysql mysql
6、創建mysql安裝目錄并授權
mkdir -p /application/mysql-5.6
mkdir -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并編譯安裝
[root@arbiter ~]# 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
[root@arbiter ~]#
[root@arbiter ~]# gunzip mysql-5.6.36.tar.gz
[root@arbiter ~]# 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
[root@arbiter ~]# tar -xvf mysql-5.6.36.tar
[root@arbiter ~]# 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
[root@arbiter ~]#
--設置mysql的環境變量
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile |
tail -l /etc/profile
source /etc/profile
echo $PATH
[root@arbiter ~]# 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
[root@arbiter ~]# source /etc/profile
[root@arbiter ~]# 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
[root@arbiter ~]#
--編譯MySQL,檢查cmake
[root@arbiter ~]# ls -l /usr/local/bin/cmake
-rwxr-xr-x 1 root root 9188179 Jul 27 00:10 /usr/local/bin/cmake
[root@arbiter ~]#
--編譯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
[root@arbiter 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
[root@arbiter mysql-5.6.36]#
--編譯安裝mysql,此階段耗時比較長,需耐心等待
[root@arbiter 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
[root@arbiter mysql-5.6.36]#
--制作軟連接
ln -s /application/mysql-5.6 /application/mysql
[root@arbiter mysql-5.6.36]# ln -s /application/mysql-5.6 /application/mysql
[root@arbiter mysql-5.6.36]#
--創建并編輯mysql的控制文件
[root@arbiter ~]# vi /etc/my.cnf
[root@arbiter ~]# 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
[root@arbiter ~]#
--初始化mysql數據庫
[root@arbiter ~]# cd /application/mysql
[root@arbiter mysql]# cd scripts/
[root@arbiter scripts]# ls
mysql_install_db
[root@arbiter scripts]# pwd
/application/mysql/scripts
[root@arbiter scripts]# ls
mysql_install_db
[root@arbiter 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
[root@arbiter scripts]#
--創建mysqld并啟動mysql數據庫
[root@arbiter support-files]# ls
binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[root@arbiter support-files]# pwd
/application/mysql/support-files
[root@arbiter support-files]# cp mysql.server /etc/init.d/mysqld
[root@arbiter support-files]# chmod +x /etc/init.d/mysqld
[root@arbiter support-files]#
[root@arbiter log]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@arbiter log]#
--登錄mysql
[root@arbiter 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文件相關:
[root@arbiter 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/tmp
chown -R mysql:mysql /application/mysql-5.6/tmp/
chmod 1771 /application/mysql-5.6/tmp/
啟動異常二、日志相關
[root@arbiter ]# /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).
[root@arbiter ]#
原因是:my.cnf配置的log目錄不存在或mysql用戶對其沒有讀寫權限
解決方法:檢查相關路徑是否存在并創建授權
mkdir -p /application/mysql-5.6/log
chown -R mysql:mysql /application/mysql-5.6/log/
chmod 775 /application/mysql-5.6/log/