Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using "cake migration" #37

Closed
joaofraga opened this issue Nov 9, 2011 · 2 comments
Closed

Error using "cake migration" #37

joaofraga opened this issue Nov 9, 2011 · 2 comments

Comments

@joaofraga
Copy link

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
---------------------------------------------------------------
<pre class="cake-debug"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr1-trace').style.display = (document.getElementById('cakeErr1-trace').style.display == 'none' ? '' : 'none');"><b>Warning</b> (2)</a>: mysql_connect() [http://php.net/function.mysql-connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) [<b>CORE/cake/libs/model/datasources/dbo/dbo_mysql.php</b>, line <b>561</b>]<div id="cakeErr1-trace" class="cake-stack-trace" style="display: none;"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr1-code').style.display = (document.getElementById('cakeErr1-code').style.display == 'none' ? '' : 'none')">Code</a> | <a href="javascript:void(0);" onclick="document.getElementById('cakeErr1-context').style.display = (document.getElementById('cakeErr1-context').style.display == 'none' ? '' : 'none')">Context</a><pre id="cakeErr1-context" class="cake-context" style="display: none;">$config    =   array(
    "persistent" => false,
    "host" => "*****",
    "login" => "*****",
    "password" => "*****",
    "database" => "*****",
    "port" => "*****",
    "driver" => "mysql",
    "prefix" => "*****"
)</pre><pre class="stack-trace">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</pre></div></pre><pre class="cake-debug"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr2-trace').style.display = (document.getElementById('cakeErr2-trace').style.display == 'none' ? '' : 'none');"><b>Warning</b> (2)</a>: mysql_query(): supplied argument is not a valid MySQL-Link resource [<b>CORE/cake/libs/model/datasources/dbo/dbo_mysql.php</b>, line <b>613</b>]<div id="cakeErr2-trace" class="cake-stack-trace" style="display: none;"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr2-code').style.display = (document.getElementById('cakeErr2-code').style.display == 'none' ? '' : 'none')">Code</a> | <a href="javascript:void(0);" onclick="document.getElementById('cakeErr2-context').style.display = (document.getElementById('cakeErr2-context').style.display == 'none' ? '' : 'none')">Context</a><pre id="cakeErr2-context" class="cake-context" style="display: none;">$sql    =   "SHOW TABLES FROM `portal_rse`;"</pre><pre class="stack-trace">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</pre></div></pre><pre class="cake-debug"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr3-trace').style.display = (document.getElementById('cakeErr3-trace').style.display == 'none' ? '' : 'none');"><b>Warning</b> (2)</a>: mysql_errno(): supplied argument is not a valid MySQL-Link resource [<b>CORE/cake/libs/model/datasources/dbo/dbo_mysql.php</b>, line <b>695</b>]<div id="cakeErr3-trace" class="cake-stack-trace" style="display: none;"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr3-code').style.display = (document.getElementById('cakeErr3-code').style.display == 'none' ? '' : 'none')">Code</a><pre class="stack-trace">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</pre></div></pre>
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

I've commented lines 87..89 and it works.

$this->Version =& new MigrationVersion(array(
    'connection' => $this->connection
));
@burzum
Copy link
Contributor

burzum commented Nov 9, 2011

This is an issue with your configuration:

mysql_connect() [http://php.net/function.mysql-connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)

Check your database connection settings.

@burzum burzum closed this as completed Nov 9, 2011
@joaofraga
Copy link
Author

It's ok, the issue was solved using 127.0.0.1 instead localhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants