recently I have moved my project from Windows (working fine running WAMP) to Linux (Ubuntu, running LAMPP) and I have got the following error:
CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]:
Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES
I have created a simple web application and I have configured the database to read my database; and works fine, I can read and execute sql statements, but if I run my project (previously working fine on Windows), it does not work on Linux. It seems like Yii can not recognize or access to my database. Why?? if a simple test (done on Linux) works??
Thanks twisted1919! but I do not think that fix the problem. I have already checked and the user has all privileges.
I can not understand why if I create a new webapp and link to my database, it works, but if I use my application, developed on Windows and now on Linux, with the same database configuration as the previously mentioned webapp, I see that error.
Well, the i think the problem might be your files encoding saved under windows, so try to update all your files with utf-8 encoding WITHOUT file BOM (any decent editor will let u do that).
Also, make sure all your classes (models/controllers/widgets) don’t have the ending ?> tag at the end of the file, neither white spaces.
Here is an example on how my PHPDesigner IDE is setup.(take a look at the attached image)