当前位置: 首页 > 工具软件 > HandlerSocket > 使用案例 >

安装mysql socket_安装MySQL和HandlerSocket

姜淇
2023-12-01

CentOS 6.5

MySQL 5.6.33

HandlerSocket 1.1.2

# Get packages

shell> wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33.tar.gz

shell> wget -O handlerSocket-1.1.2.tar.gz https://github.com/DeNA/HandlerSocket-Plugin-for-MySQL/archive/1.1.2.tar.gz

## MySQL

# System Requirements

shell> sudo yum install cmake make gcc gcc-c++ perl ncurses-devel bison libtool

shell> sudo mv /etc/my.cnf /etc/my.cnf.bak (dependes)

# Preconfiguration setup

shell> sudo groupadd mysql

shell> sudo useradd -r -g mysql -s /bin/false mysql

# Beginning of source-build specific instructions

shell> tar zxvf mysql-5.6.33.tar.gz

shell> cd mysql-5.6.33

shell> cmake .

shell> make

shell> sudo make install

# End of source-build specific instructions

# Postinstallation setup

shell> cd /usr/local/mysql

shell> sudo chown -R mysql:mysql .

shell> sudo scripts/mysql_install_db --user=mysql

shell> sudo chown -R root .

shell> sudo chown -R mysql data

shell> sudo bin/mysqld_safe --user=mysql &

# Next command is optional

shell> sudo cp support-files/mysql.server /etc/init.d/mysqld

## HandlerSocket

# Build Handlersocket

shell> tar zxvf handlerSocket-1.1.2.tar.gz

shell> cd HandlerSocket-Plugin-for-MySQL-1.1.2

shell> ./autogen.sh

shell> ./configure --with-mysql-source=/home/susl/tools/mysql-5.6.33 --with-mysql-bindir=/usr/local/mysql/bin --with-mysql-plugindir=/usr/local/mysql/lib/plugin

shell> make

shell> sudo make install

# Using Handlersocket

shell> sudo sh -c "echo '[mysqld]

loose_handlersocket_port = 9998

loose_handlersocket_port_wr = 9999

loose_handlersocket_threads = 16

loose_handlersocket_threads_wr = 1

open_files_limit = 65535

' >> /usr/local/mysql/my.cnf"

# Log in to mysql as root

mysql> install plugin handlersocket soname 'handlersocket.so';

----------

附1:二进制包/源码安装方式的MySQL卸载

1.关闭MySQL服务进程

shell> sudo service mysqld stop

2.查找MySQL的安装目录并彻底删除

#系统自带的mysql-libs包不要卸载,对应目录不要删掉:/usr/share/mysql, /usr/lib64/mysql

shell> sudo find / -name mysql

shell> sudo rm -rf xxx ...

3.视情况删除配置文件my.cnf

4.视情况删除MySQL用户以及用户组

----------

附2:配置MySQL的错误日志目录和PID存放目录

编辑my.cnf,加入以下配置信息:

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

 类似资料: