mysql, import sql file from command line

Method 1: A quick way to duplicate MySQL databases is to do the following: Step 1: Dump the database either through PHPMyAdmin’s export form or through mysqldump (as I mentioned above). Note (usually, it’s mysqldump <database-name> -h<hostname> -u<username> -p<password> if you ommit the -h switch it will default to “localhost”). After you enter the command… Continue reading mysql, import sql file from command line

yii, Executing a SQL without calling a Model

yii, Executing a SQL without calling a Model <?$connection=Yii::app()->db;$sql = “SELECT id,username FROM users”;$command = $connection->createCommand($sql); $dataReader=$command->query(); $rows=$dataReader->readAll();print_r($rows);?>