Mysqlproxy problem prompt: I recently tried mysql proxy and encountered several problems. Fortunately, I found the solution one by one and listed it as a memo. The version used this time is 0.6.x, and the new version may not have these problems.
I recently tried mysql proxy and encountered several problems. Fortunately, I found the solution one by one and listed it as a memo. The version used this time is 0.6.x, and the new version may not have these problems.
Unable to connect to mysql through mysql proxy
If the host and password are correct, you may encounter a problem where you cannot connect to mysql. check whether the mysql server uses old_password and whether there is a problem in my. cnf.
PLAIN TEXT
CODE:
Old_password = 1
Some databases are upgraded from the old version, so this option is enabled. mysql proxy does not support old_password. You can also check the password length to determine the password length:
PLAIN TEXT
CODE:
Select length (password) from mysql. user
If the length is 16 bits, it is the old_password.
Garbled characters
After connecting to the database through the proxy, the query string is always garbled, even if you manually execute set names 'utf8', it will not work.
Solution: mysql server must be set
PLAIN TEXT
CODE:
[Mysqld]
Skip-character-set-client-handshake
Init-connect = 'set NAMES utf8'
Default-character-set = utf8
When a mysql slave is disabled, the mysql proxy reports an error and all mysql instances cannot be connected.
Mysql proxy is installed for read/write splitting, including master x 1 and slave x 2. In order to test the failover, a server load balancer instance is stopped, and mysql proxy always reports an error, prompting that the connection fails. This is worse than single-point mysql. if one is dropped, it will all be dropped! Mysql engineers provided a piece of code to replace the NETWORK_MYSQLD_PLUGIN_PROTO function of src/network-mysqld-proxy.c to solve this problem.
The code is relatively long, directly attached: network-mysqld-proxy-function.c
Regular crash
This problem is also very bad. mysql proxy often stops working quietly. Fortunately, the interval is very long. I guess there is a memory leakage problem. I hope it can be solved in later versions.
The solution I use is to restart it regularly at night.