SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict bimalpoudel's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu, Nepal
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql init_connect in xampp on linux/centos 64 bit not working

    I have 64 bit centos server with xampp installed manually at /opt/lampp.
    When I attempted to do user logins on the server using init_connect string, all queries fails.
    I put the audit_connections table in mysql database, where any user should be able to INSERT.

    Code:
    CREATE TABLE mysql.`audit_connections` (
      `audit_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Audit ID',
      `connections_counter` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Total number of connections',
      `connection_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Internal Connection ID',
      `user_host` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'user@host Parameter',
      `connected_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Last connection time',
      PRIMARY KEY (`audit_id`),
      UNIQUE KEY `connection_id_user_host_key` (`connection_id`,`user_host`)
    ) COMMENT='Auditing MySQL Connections';
    Any new user created on the system should be able to INSERT on mysql.audit_connections.
    Any luck?
    Bimal Poudel @ Sanjaal Framework over Smarty Template Engine
    ASKING INTERESTING QUESTIONS ON SITEPOINT FOURM

    Hire for coding support - PHP/MySQL

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    What error do you get?

  3. #3
    SitePoint Addict bimalpoudel's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu, Nepal
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    What error do you get?
    -- Aborted connection 16344 to db: 'unconnected' user: '___' host: '___' (init_connect command failed)


    My Init Connect settings are:

    Code:
    SET GLOBAL init_connect = "
    SET collation_connection = utf8_general_ci;
    SET NAMES utf8;
    SET character_set_server = utf8;
    SET collation_server = utf8_unicode_ci;
    INSERT INTO mysql.audit_connections (
    	`connection_id`, user_host, connected_on
    ) VALUES (
    	CONNECTION_ID(), SYSTEM_USER(), NOW()
    ) ON DUPLICATE KEY UPDATE
    	connections_counter = connections_counter+1,
    	connected_on = NOW()
    ;";
    Bimal Poudel @ Sanjaal Framework over Smarty Template Engine
    ASKING INTERESTING QUESTIONS ON SITEPOINT FOURM

    Hire for coding support - PHP/MySQL

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Don't you execute those commands after having connected to the database?
    The error seems to indicate there is no connection. Do you have the commands to connect to the database in your script?

  5. #5
    SitePoint Addict bimalpoudel's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu, Nepal
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ny.cnf

    init_connect is actually set in my.ini file under [mysqld] section. So, it is set every time the server starts up.

    init_connect = "
    SET collation_connection = utf8_general_ci;
    SET NAMES utf8;
    SET character_set_server = utf8;
    SET collation_server = utf8_unicode_ci;
    INSERT INTO mysql.audit_connections (
    `connection_id`, user_host, connected_on
    ) VALUES (
    CONNECTION_ID(), SYSTEM_USER(), NOW()
    ) ON DUPLICATE KEY UPDATE
    connections_counter = connections_counter+1,
    connected_on = NOW()
    ;"
    Bimal Poudel @ Sanjaal Framework over Smarty Template Engine
    ASKING INTERESTING QUESTIONS ON SITEPOINT FOURM

    Hire for coding support - PHP/MySQL


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •