Gentoo Archives: gentoo-server

From: Dave Strydom <strydom.dave@×××××.com>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] mysql-4.1
Date: Sat, 22 Oct 2005 12:13:45
Message-Id: fc38b710510220511p7af3d09ex45b94b596b6cfe89@mail.gmail.com
In Reply to: Re: [gentoo-server] mysql-4.1 by Lance Albertson
1 Man, this ...... page messed up my mysql stuff seriously, ok, for those who
2 had the same libmysqlclient.so.12 problems i had or for those people who get
3 to the importing of all your database backup and it stuffs up. here is
4 DAVE'S guide to upgrading to MySQL 4.1
5
6
7 # = commands to type
8 = = comments
9
10 ====================================
11 # mkdir -p /home/backup/mysql
12 # nano mysql_backup.php
13
14 ==
15 = Place the code below into the mysql_backup.php and save the file =
16 ==
17
18 /*------mysql_backup.php---------*/
19 <?
20 print("mysql backup\n");
21 foreach (glob('/var/lib/mysql/*') as $fullname)
22 {
23 $database = basename($fullname);
24 $command = sprintf('mysqldump -a -B %s -c -v -Q > /home/backup/mysql/%s.sql
25 --password=\'Our@db$IG\'', $database, $database);
26
27 exec($command);
28 print($database . ' : ' . $command . "\n\n\n");
29
30 }
31 ?>
32
33
34 /*-----------------------------------------------------*/
35
36 # nano mysql_restore.php
37
38 ==
39 = Place the code below in the mysql_restore.php and save the file =
40 ==
41
42 /*------mysql_retore.php---------*/
43 <?
44
45 print("mysql backup\n");
46
47 $dir = '/home/backup/mysql/';
48 if ($fp = opendir($dir))
49 {
50 print('running...');
51 while (($file = readdir($fp)) !== FALSE) {
52 echo "$file\n";
53
54 $database = basename($file);
55 $command = sprintf('mysql < /home/backup/mysql/%s --password=\'Our@db$IG\'',
56 $database);
57 print($database . ' : ' . $command . "\n\n\n");
58 exec($command);
59
60 }
61 closedir($fp);
62 }
63 else
64 {
65 print('cannot open path ' . $dir);
66 }
67
68 ?>
69
70 /*---------------*/
71
72 # php mysql_backup.php
73
74 ==
75 = This will make individual backup's of all your databases, the reason i
76 make it create scripts for each database
77 = instead of just pumping it all into 1 database, is because if there is a
78 problem on like 486590 of a 5 million
79 = line file, its going to be a bitch to work with, this way it just
80 simplifies matters
81 ==
82
83 # quickpkg dev-db/mysql
84 # /etc/init.d/mysql stop
85 # emerge -C mysql
86 # rm -rf /var/lib/mysql/ /var/log/mysql
87 # emerge mysql
88 # etc-update
89 # emerge --config =mysql-4.1.14
90 # revdep-rebuild --soname libmysqlclient.so.12
91 # php mysql_restore.php
92 # mysql_fix_privilege_tables --defaults-file=/etc/mysql/my.cnf --user=root
93 --password='PASSWORD'
94 # /etc/init.d/mysql restart
95
96 And thats it.
97 =======================================
98
99 Dave

Replies

Subject Author
Re: [gentoo-server] mysql-4.1 Dave Strydom <strydom.dave@×××××.com>