Troubles w/ MySQL and MAMP


(system) #1

So… I've been trying to run through the example application, but I cannot seem to get the User model generated. I've noticed that a few others have had troubles because they are running php through MAMP; however, I seem to be running into a completely different error from those of everyone else.

Here is the error I receive:



model User


>> exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet' in /Applications/MAMP/htdocs/YiiTesting/framework/db/CDbCommand.php:284


Stack trace:


#0 /Applications/MAMP/htdocs/YiiTesting/framework/db/CDbCommand.php(231): CDbCommand->queryInternal('fetch', 2)


#1 /Applications/MAMP/htdocs/YiiTesting/framework/db/schema/mysql/CMysqlSchema.php(165): CDbCommand->queryRow()


#2 /Applications/MAMP/htdocs/YiiTesting/framework/db/schema/mysql/CMysqlSchema.php(68): CMysqlSchema->findConstraints(Object(CMysqlTableSchema))


#3 /Applications/MAMP/htdocs/YiiTesting/framework/db/schema/CDbSchema.php(72): CMysqlSchema->createTable('User')


#4 /Applications/MAMP/htdocs/YiiTesting/framework/cli/commands/shell/ModelCommand.php(95): CDbSchema->getTable('User')


#5 [internal function]: ModelCommand->generateModel('/Applications/M...', Array)


#6 /Applications/MAMP/htdocs/YiiTesting/framework/console/CConsoleCommand.php(116): call_user_func(Array, '/Applications/M...', Array)


#7 /Applications/MAMP/htdocs/YiiTesting/framework/cli/commands/shell/ModelCommand.php(72): CConsoleCommand->copyFiles(Array)


#8 /Applications/MAMP/htdocs/YiiTesting/framework/cli/commands/ShellCommand.php(98): ModelCommand->run(Array)


#9 /Applications/MAMP/htdocs/YiiTesting/framework/cli/commands/ShellCommand.php(78): ShellCommand->runShell()


#10 /Applications/MAMP/htdocs/YiiTesting/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run(Array)


#11 /Applications/MAMP/htdocs/YiiTesting/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)


#12 /Applications/MAMP/htdocs/YiiTesting/framework/base/CApplication.php(146): CConsoleApplication->processRequest()


#13 /Applications/MAMP/htdocs/YiiTesting/framework/yiic.php(30): CApplication->run()


#14 /Applications/MAMP/htdocs/YiiTesting/framework/yiic(15): require_once('/Applications/M...')


#15 {main}


I've tried everything I could think of to get this working, but I'm stumped.


(Qiang Xue) #2

This might be caused by the MySQL version you installed.

Try the following:

in your config.php, set 'emulatePrepare'=>true for the 'db' component.


(system) #3

Alright! That was an easy enough fix. What version of MySQL should I be running to prevent this in the future?