How to connect xampp Mysql db in Yii framework

I am new to Yii framework.i dont know the how to connect MYSQL database in xampp.

please tell me the procedure to connect MYSQL in Yii framework sample webapplication.

waiting for ur reply…

in config/main.php


return array(

...

'components'=>array(

  ...

  'db'=>array(

	'connectionString'='mysql:host=localhost;dbname=my_database',//override my_database for you actual db

	'username'=>'root',

	'password'=>''

  ),

  ...

),

...

);

you can find more infos here http://www.yiiframework.com/doc/guide/1.1/en/database.dao

Decide where you are going to place the Yii framework code (in xampp/htdocs or elsewhere). Load index.php from yii/requirements. It checks your php.ini file to see if it is configured properly for yii and displays a page showing any problems to correct. You only have to make these corrections once.

Then run yiic from the yii/framework directory to create an application under xampp/htdocs. Something like:

yiic webapp <relative path to htdocs from the yii/framework directory>/<application name>

yiic will display the list of files created if successful. You may need to fiddle with the relative path depending on where you decided to install the yii directory. If the application folder is not created under htdocs, yiic created it somewhere and you need to look for it. Use the incorrect location as the basis for correcting your relative path. Don’t use the application code created if it is not installed under xampp/htdocs (delete it) because yiic adds the correct path to find the yii/framework directory based on the relative path to the target directory (xampp/htdocs). If the files were created in the wrong place the relative path in your bootstrap file (index.php) will be wrong. When the the code is created under xampp/htdocs, your application should appear when you load its index.php.

Once your application is created in the correct location, you can make the changes recommended above. You might also want to enable gii in your main.php configuration file if you want to use a graphical interface for generating code rather than the console interface in yiic.

The only other change you might want to make is to the Apache configuration (xampp/apache/conf/httpd.conf) where you might need to uncomment:


LoadModule rewrite_module modules/mod_rewrite.so



Some wrapper components for third-party applications or libraries need mod_rewrite enabled.

/* moved - not a tip, snippet or tutorial */

I have a doubt, im trying to do the begginer tutorial. When i try to create an user simply it doesnt and no show any error message, i change the main.php in the line of connecting db, because the tuto say to do in sqllite.

note: i have installed xampp v3.0.12. I made the table user, there are any secret or add a new code line to solve the problem.

Thanks, i appreciate a soon answer.

I have created MySQL database named test_1, and I access it with root user (with password test123).

So my DB configuration looks like this in protected/config/main.php:


		'db'=>array(

			'connectionString'=>'mysql:host=localhost;dbname=test_1',

			'emulatePrepare'=>true,

			'username'=>'root',

			'password'=>'test123',

			'charset'=>'utf8',

		),