/[gentoo]/xml/htdocs/doc/en/mysql-upgrading.xml
Gentoo

Contents of /xml/htdocs/doc/en/mysql-upgrading.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download) (as text)
Wed Jan 4 11:26:16 2006 UTC (12 years, 9 months ago) by neysx
Branch: MAIN
Changes since 1.6: +8 -8 lines
File MIME type: application/xml
#117610 Quote password

1 rane 1.1 <?xml version='1.0' encoding="UTF-8"?>
2     <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 neysx 1.7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrading.xml,v 1.6 2005/12/21 11:03:31 neysx Exp $ -->
4 rane 1.1
5     <guide link="/doc/en/mysql-upgrading.xml">
6     <title>Upgrade guide to MySQL 4.1.x</title>
7    
8     <author title="Author">
9     <mail link="citizen428@gentoo.org">Michael Kohl</mail>
10     </author>
11     <author title="Author">
12     <mail link="vivo@gentoo.org">Francesco Riosa</mail>
13     </author>
14    
15     <abstract>
16     The MySQL herd is proud to announce that MySQL 4.1 can now be found in Gentoo's
17     unstable tree (~arch). As the team hopes that it soon will be able to stabilize
18     this ebuild, here's an upgrade path for all willing testers.
19     </abstract>
20    
21     <!-- The content of this document is licensed under the CC-BY-SA license -->
22     <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
23     <license/>
24    
25 neysx 1.7 <version>1.6</version>
26     <date>2006-01-04</date>
27 rane 1.1
28     <chapter>
29     <title>Upgrading from old versions of MySQL</title>
30     <section>
31     <body>
32    
33     <p>
34     Users upgrading from an old version (&lt;4.0.24) of MySQL will first have to
35     install MySQL 4.0.25. If you are already running a current version, you can skip
36     this section and continue with the next one.
37     </p>
38    
39     <pre caption="Simple upgrade">
40     # <i>emerge -av --buildpkg "&lt;mysql-4.1"</i>
41     </pre>
42    
43     </body>
44     </section>
45     </chapter>
46    
47     <chapter>
48     <title>Creating a backup of your current data</title>
49     <section>
50     <body>
51    
52     <p>
53 rane 1.2 One of the most important tasks that every database administrator has to perfom
54     is backing up data. Here we go:
55 rane 1.1 </p>
56    
57     <pre caption="Dump of all databases">
58     # <i>mysqldump \</i>
59     <i>-uroot \</i>
60 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i> \</i>
61 rane 1.1 <i>-hlocalhost \</i>
62     <i>--all-databases \</i>
63     <i>--opt \</i>
64     <i>--allow-keywords \</i>
65     <i>--flush-logs \</i>
66     <i>--hex-blob \</i>
67     <i>--master-data \</i>
68     <i>--max_allowed_packet=16M \</i>
69 rane 1.3 <i>--quote-names \</i>
70 rane 1.1 <i>--result-file=BACKUP_MYSQL_4.0.SQL</i>
71     </pre>
72    
73     <p>
74 rane 1.2 Now a file named <path>BACKUP_MYSQL_4.0.SQL</path> should exist, which later can
75     be used to recreate your data. The data is described in the MySQL dialect of SQL,
76 rane 1.1 the Structured Query Language.
77     </p>
78    
79     <p>
80 rane 1.2 Now would also be a good time to see if the backup you have created is working.
81 rane 1.1 </p>
82    
83     </body>
84     </section>
85     </chapter>
86    
87     <chapter>
88     <title>Upgrading from recent versions of MySQL</title>
89     <section>
90     <body>
91    
92     <p>
93 rane 1.2 If you have skipped step #1, you now have to create a backup package (of the
94 rane 1.1 database server, not the data) of the currently installed version:
95     </p>
96    
97     <pre caption="Binary package backup">
98     # <i>quickpkg dev-db/mysql</i>
99     </pre>
100    
101     <p>
102 rane 1.2 Now it's time to clean out the current version and all of its data:
103 rane 1.1 </p>
104    
105     <pre caption="Uninstall MySQL">
106     # <i>/etc/init.d/mysql stop</i>
107     # <i>emerge -C mysql</i>
108 rane 1.4 # <i>tar cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/</i>
109 rane 1.1 # <i>ls -l ~/mysql.*</i>
110     # <i>rm -rf /var/lib/mysql/ /var/log/mysql</i>
111     </pre>
112    
113     <note>
114 rane 1.2 Now two different backups should exist: The SQL one, which is portable between
115     various versions of MySQL, and the other one that will allow you to quickly
116     restore your database. This will be covered later in this doc in more detail.
117 rane 1.1 </note>
118    
119     <p>
120     After you got rid of your old MySQL installation, you can now install the new
121     version. Note that <c>revdep-rebuild</c> is necessary for rebuilding packages
122     linking against MySQL.
123     </p>
124    
125     <pre caption="Upgrading the binaries">
126     # <i>emerge -av "&gt;mysql-4.1"</i>
127     # <i>dispatch-conf</i>
128     # <i>revdep-rebuild</i>
129     </pre>
130    
131     <p>
132     Now configure the newly installed version of MySQL and restart the daemon:
133     </p>
134    
135     <pre caption="Configure MySQL 4.1 base setup">
136 neysx 1.5 # <i>emerge --config =mysql-4.1.&lt;micro_version&gt;</i>
137 rane 1.1 # <i>/etc/init.d/mysql start</i>
138     </pre>
139    
140     <p>
141     Finally you can import the backup you have created during step #2:
142     </p>
143    
144     <pre caption="Importing the SQL backup">
145     # <i>cat BACKUP_MYSQL_4.0.SQL \</i>
146     <i>| mysql \</i>
147     <i>-uroot \</i>
148 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i> \</i>
149 rane 1.1 <i>-hlocalhost \</i>
150     <i>--max_allowed_packet=16M</i>
151    
152     # <i>mysql_fix_privilege_tables \</i>
153     <i>--defaults-file=/etc/mysql/my.cnf \</i>
154     <i>--user=root \</i>
155 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i></i>
156 rane 1.1 </pre>
157    
158     <p>
159     If you now restart your MySQL daemon and everything went as expected, you will
160     have a fully working version of 4.1.x! :-)
161     </p>
162    
163     <pre caption="Restart the MySQL instance">
164     # <i>/etc/init.d/mysql restart</i>
165     </pre>
166    
167     <p>
168     If you encountered any problems during the upgrade process, please report them
169     at our <uri link="https://bugs.gentoo.org">Bugzilla</uri>.
170     </p>
171    
172     </body>
173     </section>
174     </chapter>
175    
176     <chapter>
177     <title>Recover the old installation of MySQL 4.0</title>
178     <section>
179     <body>
180    
181     <p>
182 rane 1.2 If you are not happy with MySQL 4.1, it's possible to go back to MySQL 4.0.
183 rane 1.1 </p>
184    
185     <pre caption="Back to the past">
186     # <i>/etc/init.d/mysql stop</i>
187     # <i>emerge -C mysql</i>
188     # <i>rm -rf /var/lib/mysql/ /var/log/mysql</i>
189     # <i>emerge --usepkgonly "&lt;mysql-4.1"</i>
190 rane 1.2 # <i>tar -xjpvf mysql.[tag] -C /</i>
191 rane 1.1 # <i>/etc/init.d/mysql start</i>
192     </pre>
193    
194     </body>
195     </section>
196     </chapter>
197    
198     <chapter>
199     <title>Straight upgrade, not supported, dangerous</title>
200     <section>
201     <body>
202    
203     <p>
204 rane 1.2 Under certain conditions it's possible to directly upgrade to the next major
205     version of MySQL. If you know what you're doing and think that applies to your
206     case, here's a little trick that makes it possible to directly upgrade to
207     MySQl 4.1.
208 rane 1.1 </p>
209    
210     <pre caption="Straight upgrade">
211     # <i>quickpkg dev-db/mysql</i>
212     # <i>/etc/init.d/mysql stop</i>
213     # <i>tar -cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/</i>
214     # <i>ls -l ~/mysql.*</i>
215     # <i>export MYSQL_STRAIGHT_UPGRADE=1</i>
216     # <i>emerge -av "&gt;mysql-4.1"</i>
217     # <i>unset MYSQL_STRAIGHT_UPGRADE</i>
218     # <i>dispatch-conf</i>
219     # <i>revdep-rebuild</i>
220     # <i>/etc/init.d/mysql start</i>
221     # <i>mysql_fix_privilege_tables --defaults-file=/etc/mysql/my.cnf \</i>
222 neysx 1.7 <i>-uroot --password=</i><comment>'your_password'</comment><i></i>
223     # <i>mysql --database=mysql -uroot --password=</i><comment>'your_password'</comment><i> &lt; /tmp/new_pieces.sql</i>
224 rane 1.1 # <i>/etc/init.d/mysql restart</i> # just to be sure
225     </pre>
226    
227     <p>
228 rane 1.2 Good luck and if something fails, don't say we didn't warn you! ;-)
229 rane 1.1 </p>
230    
231     </body>
232     </section>
233     </chapter>
234    
235     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20