Changing the collation for all tables in a MySQL database can be time consuming depending on how many tables you have.
That’s why we recommend using the following PHP script for changing the collation for all tables at a time:
<?php
$db = mysql_connect(‘localhost’,’myuser_mydbuser‘,’mypassword‘);
if(!$db) echo “Cannot connect to the database – incorrect details”;
mysql_select_db(‘myuser_mydbname’); $result=mysql_query(‘show tables’);
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query(“ALTER TABLE $value COLLATE utf8_general_ci“);
}}
echo “The collation of your database has been successfully changed!”;
?>
Make sure to substitute in the above script:
- myuser_mydbname with your database name;
- myuser_mydbuser with your mysql username;
- mypassword with your password for the mysql user;
- utf8-general_ci with your new collation if different;
Add panic=10 to the kernel command line to reboot with 10 seconds of a kernel error. Be careful with this when setting up new kernels.
It’s possible to change it later with sysctl, or by writing to /proc:
# echo 10 > /proc/sys/kernel/panic
To make it permanent, edit /etc/sysctl.conf and add the below line:
kernel.panic = 10
`sysctl -p` to load the conf file and make permanent.
When converting from IDE to AHCI in the BIOS to include additional drives, I would get a kernel panic… as by default the bios was setup with the drives as IDE.
Read the rest of this entry
Here’s is a simple shell script to run a weekly lvm snapshot dump of all OpenVZ containers using the vzdump utility:
Read the rest of this entry