Now it's MySQL's turn...
Some problems encounted this afternoon, when trying to setup/test mysql capabilities on hypnos and virgil.
1.ERROR 2003 (HY000): Can't connect to MySQL server on 'server-name' (111)
access locally (i.e. from localhost) is fine, when trying remotely got this error. when tried with mysql++ library, got the following:
terminate called after throwing an instance of 'mysqlpp::ConnectionFailed'
what(): Can't connect to MySQL server on 'hypnos' (111)
After some searches, it appears this is just indicate network issue, not to do with mysql authentication.
TWO
most likely reasons are:
a.
with --skip-networking
on it will
not accept TCP/IP connections at all.
b. with
--bind-address=127.0.0.1
, it
will listen for TCP/IP connections only locally on the
loopback interface and will not accept remote connections.
did find skip-networking option from mysql-workbench and it's off, not find bind-address at all from intotal maybe hundreds options, but it turned out it IS bind-address THE ARCH CRIMINAL!!!
solution: comments out bind-address=127.0.0.1
from /etc/mysql/my.cnf
Some other tips came across during the search
2. UFW -- The default firewall configuration tool for Ubuntu.
https://help.ubuntu.com/community/UFW
http://blog.bodhizazen.net/linux/firewall-ubuntu-gufw/
http://blog.bodhizazen.net/linux/fir...untu-desktops/
http://blog.bodhizazen.net/linux/fir...buntu-servers/
example:
To allow/deny incoming tcp and
udp packet on port 53
sudo ufw allow/deny 53
example:
To allow/deny incoming tcp packets on port 53
sudo ufw allow/deny 53/tcp
example:
To allow/deny incoming udp packes on port 53
sudo ufw allow/deny 53/udp
3. Error communicating with gnome-keyring-daemon, when initially using mysql-workbench
to connect to mysql database
a good collection of threads:
http://ubuntuforums.org/showthread.php?p=9359283
1)
gnome-keyring-daemon
is a pie
Ïà¹ØÎĵµ£º
ysqlĬÈÏÊDz»ÔÊÐíÔ¶³ÌÁ¬½ÓµÄ£¬ÒòΪÓкܴóµÄ°²È«Òþ»¼¡£
¡¡¡¡ÐèÒªÊÖ¶¯Ôö¼Ó¿ÉÒÔÔ¶³Ì·ÃÎÊÊý¾Ý¿âµÄÓû§¡£
¡¡¡¡·½·¨Ò»¡¢±¾µØµÇÈëmysql£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï½«"localhost"¸ÄΪ"%"
#mysql -u root -proot
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
my ......
Ò» . °²×°ÓëÅäÖÃMYSQL
¶þ . ³£ÓÃmysqlÃüÁîÐÐÃüÁî
1 .mysqlµÄÆô¶¯ÓëÍ£Ö¹
Æô¶¯MYSQL·þÎñ net start mysql
Í£Ö¹MYSQL·þÎñ net stop mysql
2 . netstat –na | findstr 3306 ²é¿´±»¼àÌýµÄ¶Ë¿Ú , findstrÓÃÓÚ²éÕÒºóÃæµÄ¶Ë¿ÚÊÇ·ñ´æÔÚ
3 . ÔÚÃüÁîÐÐÖеǽMYSQL¿ØÖÆ̨ , ¼´Ê¹Óà MYSQL COMMEND LINE TOOL
......
¹«Ë¾µÄ·þÎñÆ÷ÊÇCentOS 5.4(Final)°æµÄ£¬½ñÌìÔÚÉÏÃæ°²×°ÁËÒ»»Ømysql5.5£¬¼Ç¼ÈçÏ£º
1¡¢´Óhttp://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.2-m2.tar.gz ÏÂÔØÔ´Âë°²×°°üµ½/usr/local/src
2¡¢tar zxvf mysql-5.5.2-m2.tar.gz ½âѹµ½/usr/local/src/mysql-5.5.2-m2ÏÂ
cd mysql-5.5.2-m2/
&n ......
Ò»Ö±ÒÔΪmysqlËæ»ú²éѯ¼¸ÌõÊý¾Ý£¬¾ÍÓÃ
SELECT
*
from
`
table
`
ORDER
BY
RAND
() LIMIT
5
¾Í¿ÉÒÔÁË¡£
µ«ÊÇÕæÕý²âÊÔһϲŷ¢ÏÖÕâÑùЧÂʷdz£µÍ¡£Ò»¸ö15ÍòÓàÌõµÄ¿â£¬²éѯ5ÌõÊý¾Ý£¬¾ÓȻҪ8ÃëÒÔÉÏ
²é¿´¹Ù·½ÊֲᣬҲ˵rand()·ÅÔÚORDER BY ×Ó¾äÖлᱻִÐж ......
ÔÚÏò±íÖвåÈëÊý¾ÝµÄʱºò£¬¾³£Óöµ½ÕâÑùµÄÇé¿ö£º1. Ê×ÏÈÅжÏÊý¾ÝÊÇ·ñ´æÔÚ£» 2. Èç¹û²»´æÔÚ£¬Ôò²åÈ룻3.Èç¹û´æÔÚ£¬Ôò¸üС£
ÔÚ SQL Server ÖпÉÒÔÕâÑù´¦Àí£º
if not exists (select 1 from t where id = 1) insert into t(id, update_time) values(1, getdate()) else update t set update_time = getdate() where id = ......