【環境說明】
伺服器版本 redhat5.3
mysql版本 mysql5.6.22freeradius版本 2.1.12
【問題描述】
配置好freeradius的sql.conf中的資料庫位址,以及登入使用者名稱和密碼後,使用「radiusd -x」除錯模式啟動radius,控制台一直在漫長的輸出嘗試連線mysql的日 志,如下所示:
2014-12-30 09:27:39 debug sql.c 93 - [rlm_sql] starting 0
2014-12-30 09:27:39 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #0
2014-12-30 09:27:39 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #0
2014-12-30 09:27:56 info sql.c 58 - [rlm_sql] connected new db handle, #0
2014-12-30 09:27:56 debug sql.c 93 - [rlm_sql] starting 1
2014-12-30 09:27:56 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #1
2014-12-30 09:27:56 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #1
2014-12-30 09:28:12 info sql.c 58 - [rlm_sql] connected new db handle, #1
2014-12-30 09:28:12 debug sql.c 93 - [rlm_sql] starting 2
2014-12-30 09:28:12 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #2
2014-12-30 09:28:12 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #2
2014-12-30 09:28:28 info sql.c 58 - [rlm_sql] connected new db handle, #2
2014-12-30 09:28:28 debug sql.c 93 - [rlm_sql] starting 3
2014-12-30 09:28:28 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #3
2014-12-30 09:28:28 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #3
2014-12-30 09:28:44 info sql.c 58 - [rlm_sql] connected new db handle, #3
2014-12-30 09:28:44 debug sql.c 93 - [rlm_sql] starting 4
2014-12-30 09:28:44 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #4
2014-12-30 09:28:44 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #4
2014-12-30 09:29:00 info sql.c 58 - [rlm_sql] connected new db handle, #4
2014-12-30 09:29:00 debug sql.c 93 - [rlm_sql] starting 5
2014-12-30 09:29:00 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #5
2014-12-30 09:29:00 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #5
2014-12-30 09:29:17 info sql.c 58 - [rlm_sql] connected new db handle, #5
2014-12-30 09:29:17 debug sql.c 93 - [rlm_sql] starting 6
2014-12-30 09:29:17 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #6
2014-12-30 09:29:17 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #6
2014-12-30 09:29:32 info sql.c 58 - [rlm_sql] connected new db handle, #6
2014-12-30 09:29:32 debug sql.c 93 - [rlm_sql] starting 7
2014-12-30 09:29:32 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #7
2014-12-30 09:29:32 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #7
2014-12-30 09:29:48 info sql.c 58 - [rlm_sql] connected new db handle, #7
2014-12-30 09:29:48 debug sql.c 93 - [rlm_sql] starting 8
2014-12-30 09:29:48 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #8
2014-12-30 09:29:48 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #8
2014-12-30 09:30:04 info sql.c 58 - [rlm_sql] connected new db handle, #8
2014-12-30 09:30:04 debug sql.c 93 - [rlm_sql] starting 9
2014-12-30 09:30:04 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #9
2014-12-30 09:30:04 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #9
2014-12-30 09:30:21 info sql.c 58 - [rlm_sql] connected new db handle, #9
2014-12-30 09:30:21 debug sql.c 93 - [rlm_sql] starting 10
2014-12-30 09:30:21 info sql.c 54 - [rlm_sql] attempting to connect rlm_sql_mysql #10
2014-12-30 09:30:21 info sql_mysql.c 79 - [rlm_sql_mysql] starting connect to mysql server for #10
2014-12-30 09:30:37 info sql.c 58 - [rlm_sql] connected new db handle, #10
到99以後提示失敗,經查閱相關資料,進行如下處理即解決問題
【原因分析】
【解決辦法】mysql網域名稱反向解析
【可能存在問題】步驟:
1 vim /usr/my.cnf; mysql5.6.22版的配置檔案在/usr/下,編輯my.cnf,在[mysqld]下增加一行「skip-name-resovle」,儲存退出;
2 重啟mysql;
3 重新啟動radius;
mysql客戶端連線伺服器時,伺服器會對客戶端進行反向網域名稱解析,因此這個是耗時多的原因,取消網域名稱解析以後,mysql的許可權表(user表)中將不能再使用類似localhost之類的主機名,而必須使用ip位址。
---- 《僅供參考》 ----
ruby連線mysql Ruby連線Mysql
ruby連線mysql 前面一章節我們介紹了 ruby dbi 的使用。這章節我們技術 ruby 連線 mysql 更高效的驅動 mysql2,目前也推薦使用這種方式連線 mysql。安裝 mysql2 驅動 gem install mysql2 你需要使用 with mysql config 配置...
mysqli connect不能連線mysql8
mysqli conenct,不能連線。加上mysqli connect error 之後,很快查到原因 原因是新版本mysql8 的密碼加密方式已經改變,而php 的加密方式沒有公升級。所以造成密碼識別不了。暫時,只能不用mysql8 的高階加密方式,而用原來的加密方式。方法 進入mysql控制台...
pdo判斷連線mysql PDO 連線mysql
dbh new pdo mysql host localhost dbname access control root dbh setattribute pdo attr errmode,pdo errmode exception dbh exec set names utf8 新增 sql ins...