oh yeah, and change the --password='' field to your own password, dont just copy past. Dave On 10/22/05, Dave Strydom wrote: > > Man, this ...... page messed up my mysql stuff seriously, ok, for those > who had the same libmysqlclient.so.12 problems i had or for those people > who get to the importing of all your database backup and it stuffs up. here > is DAVE'S guide to upgrading to MySQL 4.1 > > > # = commands to type > = = comments > > ==================================== > # mkdir -p /home/backup/mysql > # nano mysql_backup.php > > == > = Place the code below into the mysql_backup.php and save the file = > == > > /*------mysql_backup.php---------*/ > print("mysql backup\n"); > foreach (glob('/var/lib/mysql/*') as $fullname) > { > $database = basename($fullname); > $command = sprintf('mysqldump -a -B %s -c -v -Q > > /home/backup/mysql/%s.sql --password=\'Our@db$IG\'', $database, > $database); > > exec($command); > print($database . ' : ' . $command . "\n\n\n"); > > } > ?> > > > /*-----------------------------------------------------*/ > > # nano mysql_restore.php > > == > = Place the code below in the mysql_restore.php and save the file = > == > > /*------mysql_retore.php---------*/ > > print("mysql backup\n"); > > $dir = '/home/backup/mysql/'; > if ($fp = opendir($dir)) > { > print('running...'); > while (($file = readdir($fp)) !== FALSE) { > echo "$file\n"; > > $database = basename($file); > $command = sprintf('mysql < /home/backup/mysql/%s --password=\'Our@db$IG\'', > $database); > print($database . ' : ' . $command . "\n\n\n"); > exec($command); > > } > closedir($fp); > } > else > { > print('cannot open path ' . $dir); > } > > ?> > > /*---------------*/ > > # php mysql_backup.php > > == > = This will make individual backup's of all your databases, the reason i > make it create scripts for each database > = instead of just pumping it all into 1 database, is because if there is a > problem on like 486590 of a 5 million > = line file, its going to be a bitch to work with, this way it just > simplifies matters > == > > # quickpkg dev-db/mysql > # /etc/init.d/mysql stop > # emerge -C mysql > # rm -rf /var/lib/mysql/ /var/log/mysql > # emerge mysql > # etc-update > # emerge --config =mysql-4.1.14 > # revdep-rebuild --soname libmysqlclient.so.12 > # php mysql_restore.php > # mysql_fix_privilege_tables --defaults-file=/etc/mysql/my.cnf --user=root > --password='PASSWORD' > # /etc/init.d/mysql restart > > And thats it. > ======================================= > > Dave >