If "#skip-innodb" appears, remove the "#" and restart MySQL;
If the first one cannot be resolved, add the configuration: Default-storage-engine=innodb and then restart MySQL.
- Access MySQL data according to Mysql>show engines;
Transfer from Baidu Experience: http://jingyan.baidu.com/article/3a2f7c2e68ac4426afd61108.html
Thanks to Baidu Experience
Transaction processing data
1<?PHP2 Try{3$pdo =NewPDO ("mysql:host=xxxx;dbname=xxxx","xxxx","xxxx");4$pdoSetAttribute (pdo::attr_errmode,pdo::errmode_exception);5$pdo->setattribute (Pdo::attr_autocommit,0);6 7}Catch(pdoexception $e) {8Echo"database connection failed:". $egetMessage ();9 exit;Ten } One A //Exce () returns the number of rows affected; - //$affected _rows= $pdo->exec ("INSERT into shops (NAME,PRICE,NUM,DESN) VALUES (' AA ', ' 12.1 ', ' ten ', ' good ')"); - //echo "Last inserted auto-growing ID". $pdo->lastinsertid (); the - //Setting the error reporting mode - //if (! $affected _rows) { - //echo $pdo->errorcode (). " <br> "; + //Print_r ($pdo->errorinfo ()); - + //}else{ A at //echo "Successful execution"; - //} - - Try{ -$pdoBeginTransaction (); -$price = -; in$sql ="Update Zhanghao set price=price-{$price} where id=1"; - to$affected _rows= $pdoexec ($sql); + -$sql ="Update Zhanghao set price=price+{$price} where id=2"; the *$affected _rows= $pdoexec ($sql); $Echo"Trading Success");Panax Notoginseng$pdocommit (); - the}Catch(pdoexception $e) { +Echo $egetMessage (); A$pdoRollBack (); the } + -?>View Code
MYSQL Event Engines=innodb