Example #1
0
 public static function get()
 {
     $factory = new self(array(getenv('HOME') . '/.my.cnf'), array('127.0.0.1', 'localhost'), array(3306, 3307, 8889));
     $datasource = $factory->createDatasource();
     if (!$datasource) {
         throw new \RuntimeException("Failed to locate MySQL service via ~/.my.cnf");
     }
     $mysql = new \Amp\Database\MySQL();
     $mysql->setAdminDatasource($datasource);
     return $mysql;
 }