2

I'm getting the following error from my page at http://ocytoronto.org/demo/.

CDbConnection failed to open the DB connection: SQLSTATE[HY000]: General error: 1193 Unknown system variable 'NAMES'

What's more confusing is this used to work fine till yesterday. Any help?

Main.php added.

return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Office of Catholic Youth, Roman Catholic Archdiocese of Toronto',

// preloading 'log' component
'preload'=>array('log'),

// autoloading model and component classes
'import'=>array(
    'application.models.*',
    'application.components.*',
),

'modules'=>array(
    // uncomment the following to enable the Gii tool

    'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'PASSWORD',
        // If removed, Gii defaults to localhost only. Edit carefully to taste.
        'ipFilters'=>array('127.0.0.1','::1'),
    ),

),

// application components
'components'=>array(
    'user'=>array(
        // enable cookie-based authentication
        'allowAutoLogin'=>true,
    ),
    // uncomment the following to enable URLs in path-format

    'urlManager'=>array(
        'urlFormat'=>'path',
                    'showScriptName'=>true,

        'rules'=>array(
            'admin'=>'site/login',
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),

    ),

    /*'db'=>array(
        'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
    ),
    */
    // uncomment the following to use a MySQL database

    'db'=>array(
        'connectionString' => 'mysql:host=sqlc9.megasqlservers.com;dbname=ocy_db',
        'emulatePrepare' => true,
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'charset' => 'utf8',
    ),

    'errorHandler'=>array(
        // use 'site/error' action to display errors
        'errorAction'=>'site/error',
    ),
    'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            array(
                'class'=>'CFileLogRoute',
                'levels'=>'error, warning',
            ),
            // uncomment the following to show log messages on web pages
            /*
            array(
                'class'=>'CWebLogRoute',
            ),
            */
        ),
    ),
    'controllerMap'=>array(
            'YiiFeedWidget' => 'ext.yii-feed-widget.YiiFeedWidgetController'
    ),

    'file'=>array(
      'class'=>'application.extensions.file.CFile',
    ),
),

// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
    // this is used in contact page
    'adminEmail'=>'[email protected]',
),

);

Any help would me much appreciated.

6
  • What is your mysql version? Commented Sep 13, 2013 at 9:15
  • show your config main.php script Commented Sep 13, 2013 at 9:16
  • @Mihai: The version is 5.1.70. Commented Sep 13, 2013 at 9:20
  • what have you changed till yesterday? Unknown system variable says it clear; Commented Sep 13, 2013 at 9:23
  • @som: main.php added. Commented Sep 13, 2013 at 9:25

1 Answer 1

2

Not sure but you can do that
Remove : 'charset' => 'utf8' from db array

'db'=>array(
        'connectionString' => 'mysql:host=sqlc9.megasqlservers.com;dbname=ocy_db',
        'emulatePrepare' => true,
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'charset' => 'utf8', // remove this line and check
    ),
Sign up to request clarification or add additional context in comments.

2 Comments

how come? utf8 not compatible? what?
if this is the issue, this means that you might not be using linux, or the db does not support utf8 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.