Heim > Datenbank > MySQL-Tutorial > ubuntu11.10安装mysql+handlersocket_MySQL

ubuntu11.10安装mysql+handlersocket_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-01 13:49:12
Original
1187 Leute haben es durchsucht

Ubuntu

bitsCN.com

1.安装mysql:(不管要啥,一股脑都装上)

sudo apt-get install mysql-serversudo apt-get install mysql-clientsudo apt-get install libmysqlclient-devsudo apt-get install libmysqld-dev
Nach dem Login kopieren

 

2.下载mysql和handlersocket源代码:

mysql-5.1.62.tar.gz  可以自己百度

ahiguti-HandlerSocket-Plugin-for-MySQL-1.1.0-2-g395fa55.tar.gz  这个都不好下,在实验室才下到。。

3.解压

sudo tar -zxvf mysql-5.1.62.tar.gz -C /usr/local/src/sudo tar -zxvf handlersocket_1.0.6-80-g88bf1e0.orig.tar.gz  -C /usr/local/src/
Nach dem Login kopieren

 

4.编译安装handler socket

cd /usr/local/src/ahiguti-HandlerSocket-Plugin-for-MySQL-395fa55/sudo ./autogen.sh
Nach dem Login kopieren

 

小插曲:

这里出现:

错误1

Searching libtoolize...-e     WARNING: Cannot Found libtoolize... input libtool command^C
Nach dem Login kopieren

解决:

sudo apt-get install libtool
Nach dem Login kopieren

 

错误2

Searching libtoolize...-e     FOUND: libtoolize -> libtoolizeSearching aclocal...-e     WARNING: Cannot Found aclocal... input aclocal command^C
Nach dem Login kopieren

解决:

sudo apt-get install autotools-devsudo apt-get install automake
Nach dem Login kopieren

 

插曲结束~

sudo ./configure --with-mysql-source=../mysql-5.1.62 --with-mysql-bindir=/usr/bin --with-mysql-plugindir=/usr/lib/mysql/plugin
Nach dem Login kopieren


with-mysql-source 表示MySQL源代码目录,with-mysql-bindir 表示MySQL二进制可执行文件目录(也就是 mysql_config 所在目录,可以用whereis mysql_config找到),with-mysql-plugindir 表示MySQL插件目录 
如果不清楚这个目录在哪,可以按如下方法查询: 
mysql> SHOW VARIABLES LIKE 'plugin%'; 
+---------------+-----------------------+ 
| Variable_name | Value                 | 
+---------------+-----------------------+ 
| plugin_dir    | /usr/lib/mysql/plugin | 
+---------------+-----------------------+ 

sudo make & make install
Nach dem Login kopieren

 

5.修改mysql配置文件my.cnf,添加相关端口配置:

# sudo vi /etc/my.cnf [mysqld] loose_handlersocket_port = 9998 # the port number to bind to (for read requests) loose_handlersocket_port_wr = 9999 # the port number to bind to (for write requests) loose_handlersocket_threads = 16 # the number of worker threads (for read requests) loose_handlersocket_threads_wr = 1 # the number of worker threads (for write requests) open_files_limit = 65535 # to allow handlersocket accept many concurren connections, make open_files_limit as large as possible. 
Nach dem Login kopieren

6.登陆mysql

bobo@master:/usr/local/src$ mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 45Server version: 5.1.62-0ubuntu0.11.10.1 (Ubuntu)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> install plugin handlersocket soname 'handlersocket.so';Query OK, 0 rows affected (0.30 sec)<br>
Nach dem Login kopieren

插曲二:

中间又出现错误了。。

mysql> install plugin handlersocket soname 'handlersocket.so';ERROR 1126 (HY000): Can't open shared library '/usr/lib/mysql/plugin/handlersocket.so' (errno: 2 cannot open shared object file: No such file or directory)
Nach dem Login kopieren

莫名其妙的,结果我又单独make一下,再make install一下,就好了。。

我也不知道跟这个又没有关系。。。

插曲二终

通过show processlist 能在MySQL里看到HandlerSocket的线程了:

mysql>  show processlist     -> ;+----+-------------+-----------------+---------------+---------+------+-------------------------------------------+------------------+| Id | User        | Host            | db            | Command | Time | State                                     | Info             |+----+-------------+-----------------+---------------+---------+------+-------------------------------------------+------------------+| 45 | root        | localhost       | NULL          | Query   |    0 | NULL                                      | show processlist || 46 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 47 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 48 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 49 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 50 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 51 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 52 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 53 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 54 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 55 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 56 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 57 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 58 | system user | connecting host | handlersocket | Connect | NULL | handlersocket: mode=wr, 0 conns, 0 active | NULL             || 59 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 60 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 61 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             || 62 | system user | connecting host | NULL          | Connect | NULL | handlersocket: mode=rd, 0 conns, 0 active | NULL             |+----+-------------+-----------------+---------------+---------+------+-------------------------------------------+------------------+18 rows in set (0.00 sec)
Nach dem Login kopieren

也可以查看端口占用来验证你的mysql装好了:

bobo@master:~$ sudo lsof -i :9998COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAMEmysqld  14173 mysql   30u  IPv4  49030      0t0  TCP *:9998 (LISTEN)bobo@master:~$ sudo lsof -i :9999COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAMEmysqld  14173 mysql   77u  IPv4  49032      0t0  TCP *:9999 (LISTEN)
Nach dem Login kopieren

 

7.简单测试

参考http://lsddesign.blog.163.com/blog/static/170908080201231895758377/

 

 

看了许多教程,有许多问题,觉得这个的参考价值大一些:

http://leishguolearn.googlecode.com/svn-history/r296/trunk/learn_doc/final_shguo/handlersocket

bitsCN.com
Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
So ändern Sie MySQL in MySQL
Aus 1970-01-01 08:00:00
0
0
0
MySQL-Startfehler unter Centos
Aus 1970-01-01 08:00:00
0
0
0
MySQL stoppt den Prozess
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage