CakeDC/migrations — Issue #37: Mysql error using "cake migration"
Author: joaofraga
Created: 2011-11-09 12:41:41+00:00
State: open

**When I write in terminal "cake migration" I've got the following error:**

```
Welcome to CakePHP v1.3.12 Console
---------------------------------------------------------------
App : portal-rse
Path: /Applications/MAMP/htdocs/cake/portal-rse
---------------------------------------------------------------
Cake Migration Shell
---------------------------------------------------------------

Warning (2): mysql_connect() [http://php.net/function.mysql-connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 561]

Code | Context

$config	=	array(
"persistent" => false,
"host" => "*****",
"login" => "*****",
"password" => "*****",
"database" => "*****",
"port" => "*****",
"driver" => "mysql",
"prefix" => "*****"
)

mysql_connect - [internal], line ??
DboMysql::connect() - CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 561
DboSource::__construct() - CORE/cake/libs/model/datasources/dbo_source.php, line 143
ConnectionManager::getDataSource() - CORE/cake/libs/model/connection_manager.php, line 114
MigrationVersion::__initMigrations() - APP/plugins/migrations/libs/migration_version.php, line 239
MigrationVersion::__construct() - APP/plugins/migrations/libs/migration_version.php, line 61
MigrationShell::startup() - APP/plugins/migrations/vendors/shells/migration.php, line 89
ShellDispatcher::dispatch() - CORE/cake/console/cake.php, line 376
ShellDispatcher::ShellDispatcher() - CORE/cake/console/cake.php, line 139
[main] - CORE/cake/console/cake.php, line 666

Warning (2): mysql_query(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 613]

Code | Context

$sql	=	"SHOW TABLES FROM `portal_rse`;"

mysql_query - [internal], line ??
DboMysql::_execute() - CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 613
DboMysql::listSources() - CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 626
MigrationVersion::__initMigrations() - APP/plugins/migrations/libs/migration_version.php, line 240
MigrationVersion::__construct() - APP/plugins/migrations/libs/migration_version.php, line 61
MigrationShell::startup() - APP/plugins/migrations/vendors/shells/migration.php, line 89
ShellDispatcher::dispatch() - CORE/cake/console/cake.php, line 376
ShellDispatcher::ShellDispatcher() - CORE/cake/console/cake.php, line 139
[main] - CORE/cake/console/cake.php, line 666

Warning (2): mysql_errno(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 695]

Code

mysql_errno - [internal], line ??
DboMysql::lastError() - CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 695
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 257
DboSource::begin() - CORE/cake/libs/model/datasources/dbo_source.php, line 1809
CakeMigration::run() - APP/plugins/migrations/libs/model/cake_migration.php, line 164
MigrationVersion::__initMigrations() - APP/plugins/migrations/libs/migration_version.php, line 245
MigrationVersion::__construct() - APP/plugins/migrations/libs/migration_version.php, line 61
MigrationShell::startup() - APP/plugins/migrations/vendors/shells/migration.php, line 89
ShellDispatcher::dispatch() - CORE/cake/console/cake.php, line 376
ShellDispatcher::ShellDispatcher() - CORE/cake/console/cake.php, line 139
[main] - CORE/cake/console/cake.php, line 666

Fatal error: Uncaught exception 'MigrationException' with message 'SQL Error: ' in /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/model/cake_migration.php:243
Stack trace:
#0 /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/model/cake_migration.php(220): CakeMigration->_createTable('create_table', Array)
#1 /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/model/cake_migration.php(169): CakeMigration->_run()
#2 /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/migration_version.php(245): CakeMigration->run('up')
#3 /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/migration_version.php(61): MigrationVersion->__initMigrations()
#4 /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/vendors/shells/migration.php(89): MigrationVersion->__construct(Array)
#5 /Applications/MAMP/htdocs/cakephp/cake/console/cake.php(376): MigrationShell->startup()
#6 /Applications/MAMP/htdocs/cakephp/cake/console/cake.php(139): ShellDispatcher->dispatch() in /Applications/MAMP/htdocs/cake/portal-rse/plugins/migrations/libs/model/cake_migration.php on line 243
```