How To Enable/ Disable Auto Reconnect in MySQLどのようを有効/無効にMySQLの自動再接続

What is auto reconnect in MySQL? MySQLの自動再接続は何ですか?
The MySQL client library can perform an automatic reconnect to the server if it finds that the connection is down when you attempt to send a statement to the server to be executed. MySQLのクライアントライブラリの自動再接続を実行することが見つかった場合、サーバーがダウンして接続しようとしたときに、サーバーに送信するステートメントを実行される。 In this case, the library tries once to reconnect to the server and send the statement again.この場合には、一度のライブラリをしようとすると、サーバーへの再接続に声明を再度送信してください。
Automatic reconnection can be convenient because you need not implement your own reconnect code, but if a reconnection does occur, several aspects of the connection state are reset and your application will not know about it.自動再接続できる便利なために、独自の再接続コードを実装する必要はない、しかし、もし再接続が発生した場合は、いくつかの側面には、接続の状態がリセットされ、アプリケーションが特定して教えてください。 This is extremely useful if you long running persistent connections to the database.これは非常に有用な実行時間の長い持続的な接続する場合には、データベースです。 Also if you have too many sql queries / use connection pool etc. auto reconnect is a handy feature.またSQLクエリを実行する場合が多すぎる/接続プールの使用等の自動再接続ができる便利な機能です。 Let’s look at how to enable / disable auto reconnect in MySQL and what are the side-effects of enabling auto reconnect.方法について見てみましょうを有効/無効に自動再接続でMySQLとどのような副作用は、自動再接続を有効にします。
How to enable MySQL client auto reconnect mysqlクライアントの自動再接続を有効にする方法
my_bool reconnect = 1; my_bool再= 1 ;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); mysql_options ( & MySQLでは、 mysql_opt_reconnect 、 &再接続) ;
What are the side-effects of MySQL auto reconnect?どのような副作用は、 mysql自動再接続ですか?
- Any active transactions are rolled back and autocommit mode is reset.任意のアクティブなトランザクションはロールバックさや自動コミットモードがリセットされます。
- All table locks are released.すべてのテーブルロックが解放されます。
- All TEMPORARY tables are closed (and dropped).すべてのテンポラリテーブルが閉じ( &ドロップ) 。
- Session variables are reinitialized to the values of the corresponding variables.セッション変数が再初期化して、対応する変数の値をします。 This also affects variables that are set implicitly by statements such as SET NAMES.この変数にも影響を及ぼすようなステートメントが設定され暗黙のうちにセット名を表示します。
- User variable settings are lost.ユーザ変数の設定が失われる。
- Prepared statements are released.準備されたステートメントがリリースされました。
- HANDLER variables are closed.ハンドラの変数が閉じられます。
- The value of LAST_INSERT_ID() is reset to 0.の値をLAST_INSERT_ID ( )のは0にリセットされます。
- Locks acquired with GET_LOCK() are released.ロック後天性get_lock ( )が解放されます。
- mysql_ping() does not attempt a reconnection if the connection is down. mysql_ping ( )されない場合は、接続が再接続を試みるダウンします。 It returns an error instead.代わりに、エラーが返されます。
How to disable MySQL client auto reconnect mysqlクライアントの自動再接続を無効にする方法
In view of the side-effects you may want to disable auto reconnect.の対象は、副作用の自動再接続を無効にすることができます。 In MySQL version 5.1 and above auto reconnect is disabled by default. MySQLのバージョン5.1と上記の自動再接続はデフォルトで無効にします。 In any version you can disable auto reconnect with the following PHP code:すべてのバージョンでの自動再接続を無効にすることができます。は、次のPHPコード:
my_bool reconnect = 0; my_bool再= 0 ;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); mysql_options ( & MySQLでは、 mysql_opt_reconnect 、 &再接続) ;
Filed under提出されて Databaseデータベース , 、 Enterprise Softwareエンタープライズソフトウェア , 、 Headline Newsニュースの見出し , 、 How Toどのように , 、 Java Software Javaソフトウェア , 、 MySQL MySQLの , 、 Open Source Softwareオープンソースのソフトウェア , 、 PHP PHPの , 、 Programmingプログラミング , 、 RDBMS RDBMSのより多くの , 、 Tech Note技術のノート | |
| |
RSS 2.0 RSS 2.0を | |
Trackbackトラックバック this Article |この記事|
Email this Article電子メールこの記事
You may also like to readを読むようにすることも可能 |





October 17th, 2007 at 1:25 pm 2007年10月17日は1:25 pmの
That’s not PHP codeそれはPHPコード
C/C++ perhaps.用C / C + +たぶん。
October 18th, 2007 at 1:08 pm 2007年10月18日1:08 pmの
It is PHP code.これはPHPコードです。 Check the fine manualマニュアルを確認して罰金
May 23rd, 2008 at 4:15 pm 2008年5月23日4:15 pmの
There’s no mysql_options() command listed anywhere in PHP documentation that I can find (trying to use it gives an ‘undefined function’ error).ないmysql_options ( )をコマンドに記載の任意の場所を見つける私はPHPのマニュアルを参照し(しようとして使用することにより、 '未定義関数'エラーが発生) 。 my_bool is definitely not a PHP variable type. my_bool PHPの変数の型ではありません。 PHP variables also need $’s, of which you have none. PHP変数も必要$ '秒、その必要がなし。 I’m sorry, but this is NOT php code.申し訳なく存じますが、しかし、これではないPHPコードです。
You provide useful explanation of auto-reconnection functionality, but please don’t mislead people by claiming it’s useful code for PHP developers.役に立つの説明を提供する自動再接続機能、しかし、人々はご遠慮を欺くの有用性を主張してコードをPHPの開発者です。