Some time when you upgrade mysql you may notice this error “start: Job failed to start”, in my case I have big databases on my vps server and causes this problem most often. The problem is that the files ‘/var/lib/mysql/ib_logfile0’ and ‘/var/lib/mysql/ib_logfile1’ are bigger in size than mysql is expecting. The solution is very simple

Installation 1. Installing MySQL 5 sudo apt-get install mysql-server mysql-client 2. Installing Apache2 sudo apt-get install apache2 3. Installing PHP5 sudo apt-get install php5 libapache2-mod-php5 sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl sudo apt-get install php5-xcache 4. Restart Apache sudo /etc/init.d/apache2

Yii model findBySql does not return related data but returns only its own fields. To get around it always use model like: $model = User::model()->with(‘posts’)->find …. Now model fetch related data from posts table as well. However this won’t work. $model = User::model()->findBySql(‘select * from user inner join posts on ….) ….

In PHP to check if a field from MySQL is null use the keyword is_null like: is_null($row[‘fld’]) In PHP to insert a Null value into MySQL field use the trick: $date = is_null($row[‘date’]) ? “null”: “‘” . $row[‘date’] “‘”; The following will not work: $date = is_null($row[‘date’]) ? NULL: “‘” . $row[‘date’] “‘”; This is

Stop the mysql demon process using this command : sudo /etc/init.d/mysql stop Start the mysqld demon process using the –skip-grant-tables option with this command sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking & Because you are not checking user privs at this point, it’s safest to disable networking. In Dapper, /usr/bin/mysgld… did not work. However, mysqld –skip-grant-tables did. start the

How to save Swedish Characters in MySQL using PHP and display it on Web Page It was a headache and wastage of time when I came across the situation when I saw strange Swedish characters on one of my clients web page and its MySQL database. After googling I found several suggestions but no one